use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.
the class DependencyValidatorTest method testArtifactId.
@Test
public void testArtifactId() throws Exception {
DependencyValidator dependencyValidator = new DependencyValidator(new Dependency(new GAV("groupId", null, "1.0")));
assertFalse(dependencyValidator.validate());
assertEquals("DependencyIsMissingAnArtifactId", dependencyValidator.getMessage());
}
use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.
the class DependencyValidatorTest method testValid.
@Test
public void testValid() throws Exception {
DependencyValidator dependencyValidator = new DependencyValidator(new Dependency(new GAV("groupId", "artifactId", "1.0")));
assertTrue(dependencyValidator.validate());
}
use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.
the class DependencyValidatorTest method testVersion.
@Test
public void testVersion() throws Exception {
DependencyValidator dependencyValidator = new DependencyValidator(new Dependency(new GAV("groupId", "artifactId", null)));
assertFalse(dependencyValidator.validate());
assertEquals("DependencyIsMissingAVersion", dependencyValidator.getMessage());
}
use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.
the class MavenArtifactResolver method resolve.
public URI resolve(final String groupId, final String artifactId, final String version) throws Exception {
final POM projectPom = new POM(new GAV("resolver-dummy-group", "resolver-dummy-artifact", "resolver-dummy-version"));
projectPom.getDependencies().add(new Dependency(new GAV(groupId, artifactId, version)));
try {
final String pomXML = pomContentHandler.toString(projectPom);
final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));
final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);
for (Artifact mavenArtifact : mavenProject.getArtifacts()) {
if (groupId.equals(mavenArtifact.getGroupId()) && artifactId.equals(mavenArtifact.getArtifactId()) && version.equals(mavenArtifact.getVersion()) && mavenArtifact.getFile().exists()) {
return mavenArtifact.getFile().toURI();
}
}
return null;
} catch (IOException e) {
logger.error("Unable to get artifact: " + groupId + ":" + artifactId + ":" + version + " from maven repository", e);
throw new Exception("Unable to get artifact: " + groupId + ":" + artifactId + ":" + version + " from maven repository", e);
}
}
use of org.guvnor.common.services.project.model.Dependency in project kie-wb-common by kiegroup.
the class DependenciesItemPresenter method setup.
public DependenciesItemPresenter setup(final EnhancedDependency enhancedDependency, final WhiteList whiteList, final DependenciesPresenter dependenciesPresenter) {
this.enhancedDependency = enhancedDependency;
this.parentPresenter = dependenciesPresenter;
final Dependency dependency = enhancedDependency.getDependency();
view.init(this);
view.setGroupId(dependency.getGroupId());
view.setArtifactId(dependency.getArtifactId());
view.setVersion(dependency.getVersion());
view.setPackagesWhiteListedState(WhiteListedPackagesState.from(whiteList, enhancedDependency.getPackages()));
view.setTransitiveDependency(enhancedDependency instanceof TransitiveEnhancedDependency);
return this;
}
Aggregations