Examples of DependencyModel


Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

    super(helper);
  }

  @Override
  protected DependencyModel transform(Dependency mavenDependency) {
    return new DependencyModel(
        mavenDependency.getGroupId(),
        mavenDependency.getArtifactId(),
        mavenDependency.getVersion(),
        mavenDependency.getScope(),
        mavenDependency.getClassifier(),
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

  @Before
  public void before() {
    when(this.mockMavenProject.getGroupId()).thenReturn("a.b.c");
    when(this.mockMavenProject.getArtifactId()).thenReturn("parent");
    this.projectModel.getManagedDependencies().add(new DependencyModel("a.b.c", "a", "1.0", null, null, null));
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

    executeRuleAndCheckReport(false);
  }

  @Test
  public void allowedProjectVersion1() {
    DependencyModel dependency = createDependency(false, false);
    when(dependency.getVersion()).thenReturn("${project.version}");
    this.projectModel.getDependencies().add(dependency);

    executeRuleAndCheckReport(false);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

    executeRuleAndCheckReport(false);
  }

  @Test
  public void allowedProjectVersion2() {
    DependencyModel dependency = createDependency(false, false);
    when(dependency.getVersion()).thenReturn("${version}");
    this.projectModel.getDependencies().add(dependency);

    executeRuleAndCheckReport(false);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

  }

  @Test
  public void forbiddenProjectVersion() {
    this.testRule.setAllowUnmanagedProjectVersions(false);
    DependencyModel dependency = createDependency(false, false);
    when(dependency.getVersion()).thenReturn("${project.version}");
    this.projectModel.getDependencies().add(dependency);

    executeRuleAndCheckReport(true);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

    executeRuleAndCheckReport(false);
  }

  private DependencyModel createDependency(boolean withVersion, boolean withExclusion) {
    DependencyModel dependency = mock(DependencyModel.class);

    if (withVersion) {
      when(dependency.getVersion()).thenReturn("1.0");
    }

    if (withExclusion) {
      when(dependency.getExclusions()).thenReturn(Collections.singletonList(new ArtifactModel("a.b.c", "a")));
    }

    return dependency;
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

  protected void addDependency(String groupId, String artifactId, DependencyScope scope) {
    String version = DEFAULT_VERSION;

    Dependency mavenDependency = createMavenDependency(groupId, artifactId, scope, version);
    DependencyModel dependency = createDependencyModel(groupId, artifactId, version);

    this.mockMavenProject.getDependencies().add(mavenDependency);
    this.projectModel.getDependencies().add(dependency);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

  protected void addManagedDependency(String groupId, String artifactId, DependencyScope scope) {
    String version = DEFAULT_VERSION;

    Dependency mavenDependency = createMavenDependency(groupId, artifactId, scope, version);
    DependencyModel dependency = createDependencyModel(groupId, artifactId, version);

    this.mockMavenProject.getDependencyManagement().getDependencies().add(mavenDependency);
    this.projectModel.getManagedDependencies().add(dependency);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

    this.mockMavenProject.getDependencyManagement().getDependencies().add(mavenDependency);
    this.projectModel.getManagedDependencies().add(dependency);
  }

  private static DependencyModel createDependencyModel(String groupId, String artifactId, String version) {
    return new DependencyModel(groupId, artifactId, version, null, null, null);
  }
View Full Code Here

Examples of com.github.ferstl.maven.pomenforcers.model.DependencyModel

      when(plugin.isConfigured()).thenReturn(true);
    }

    if (withDependencies) {
      when(plugin.getDependencies()).thenReturn(
          Arrays.asList(new DependencyModel("x.y.z", "z", "1.0", null, null, null)));
    }

    this.testRule.getProjectModel().getPlugins().add(plugin);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.