use of org.jboss.galleon.spec.PackageSpec in project galleon by wildfly.
the class PackageBuilder method build.
public PackageSpec build(Path fpDir) {
final PackageSpec pkgSpec = pkg.build();
final Path pkgDir;
try {
pkgDir = LayoutUtils.getPackageDir(fpDir, pkgSpec.getName(), false);
} catch (ProvisioningDescriptionException e) {
throw new IllegalStateException(e);
}
try {
Files.createDirectories(pkgDir);
if (tasks != null && !tasks.isEmpty()) {
tasks.execute(FsTaskContext.builder().setTargetRoot(pkgDir).build());
}
PackageXmlWriter.getInstance().write(pkgSpec, pkgDir.resolve(Constants.PACKAGE_XML));
} catch (XMLStreamException | IOException e) {
throw new IllegalStateException(e);
}
return pkgSpec;
}
use of org.jboss.galleon.spec.PackageSpec in project galleon by wildfly.
the class PackageXmlWriterTestCase method before.
@BeforeClass
public static void before() throws Exception {
URL xsd = PackageXmlWriterTestCase.class.getClassLoader().getResource(SCHEMA);
validator = new XmlParserValidator<PackageSpec>(Paths.get(xsd.toURI()), PackageXmlParser.getInstance());
tmpDir = IoUtils.createRandomTmpDir();
}
use of org.jboss.galleon.spec.PackageSpec in project galleon by wildfly.
the class PackageXmlWriterTestCase method testAddMultipleOrigins.
@Test
public void testAddMultipleOrigins() throws Exception {
PackageSpec originalState = PackageSpec.builder().setName("test-package").addPackageDep("external1", "test-dep").addPackageDep("external2", "test-dep").addPackageDep("external2", "test-dep", true).build();
Path path = marshallToTempFile(originalState);
PackageSpec newState = validator.validateAndParse(path);
assertEquals(originalState, newState);
}
use of org.jboss.galleon.spec.PackageSpec in project galleon by wildfly.
the class PackageXmlWriterTestCase method testAddMultiplePackageDepsInSameOriginWithSameName.
@Test
public void testAddMultiplePackageDepsInSameOriginWithSameName() throws Exception {
PackageSpec originalState = PackageSpec.builder().setName("test-package").addPackageDep("external", "test-dep").addPackageDep("external", "test-dep", true).build();
Path path = marshallToTempFile(originalState);
PackageSpec newState = validator.validateAndParse(path);
assertEquals(originalState, newState);
assertTrue(firstPackage(newState, "external").isOptional());
}
use of org.jboss.galleon.spec.PackageSpec in project galleon by wildfly.
the class PackageXmlWriterTestCase method testOrderOfPackageDeps.
@Test
public void testOrderOfPackageDeps() throws Exception {
PackageSpec originalState = PackageSpec.builder().setName("test-package").addPackageDep("test-dep").addPackageDep("test-dep2").addPackageDep("test-dep3").build();
Path path = marshallToTempFile(originalState);
PackageSpec newState = validator.validateAndParse(path);
assertEquals(originalState, newState);
Iterator<PackageDependencySpec> depsIterator = newState.getLocalPackageDeps().iterator();
assertEquals("test-dep", depsIterator.next().getName());
assertEquals("test-dep2", depsIterator.next().getName());
assertEquals("test-dep3", depsIterator.next().getName());
}
Aggregations