use of org.apache.aries.application.impl.ContentImpl in project aries by apache.
the class SimpleBundleInfo method getContentSetFromHeader.
private Set<Content> getContentSetFromHeader(Attributes attributes, String key) {
String header = _attributes.getValue(key);
List<String> splitHeader = ManifestHeaderProcessor.split(header, ",");
HashSet<Content> result = new HashSet<Content>();
for (String s : splitHeader) {
Content c = new ContentImpl(s);
result.add(c);
}
return result;
}
use of org.apache.aries.application.impl.ContentImpl in project aries by apache.
the class AriesApplicationManagerImplTest method testCreate.
@Test
public void testCreate() throws Exception {
AriesApplication app = createApplication(TEST_EBA);
ApplicationMetadata appMeta = app.getApplicationMetadata();
assertEquals(appMeta.getApplicationName(), "Test application");
assertEquals(appMeta.getApplicationSymbolicName(), "org.apache.aries.application.management.test");
assertEquals(appMeta.getApplicationVersion(), new Version("1.0"));
List<Content> appContent = appMeta.getApplicationContents();
assertEquals(appContent.size(), 2);
Content fbw = new ContentImpl("foo.bar.widgets;version=1.0.0");
Content mbl = new ContentImpl("my.business.logic;version=1.0.0");
assertTrue(appContent.contains(fbw));
assertTrue(appContent.contains(mbl));
DeploymentMetadata dm = app.getDeploymentMetadata();
List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();
assertEquals(2, dcList.size());
DeploymentContent dc1 = new DeploymentContentImpl("foo.bar.widgets;deployed-version=1.1.0");
DeploymentContent dc2 = new DeploymentContentImpl("my.business.logic;deployed-version=1.1.0");
DeploymentContent dc3 = new DeploymentContentImpl("a.handy.persistence.library;deployed-version=1.1.0");
assertTrue(dcList.contains(dc1));
assertTrue(dcList.contains(dc2));
dcList = dm.getApplicationProvisionBundles();
assertEquals(1, dcList.size());
assertTrue(dcList.contains(dc3));
}
use of org.apache.aries.application.impl.ContentImpl in project aries by apache.
the class AriesApplicationManagerImplTest method testCreateAndConversion.
@Test
public void testCreateAndConversion() throws Exception {
AriesApplication app = createApplication(CONVERSION_EBA);
ApplicationMetadata appMeta = app.getApplicationMetadata();
assertEquals(appMeta.getApplicationName(), "conversion.eba");
assertEquals(appMeta.getApplicationSymbolicName(), "conversion.eba");
assertEquals(appMeta.getApplicationVersion(), new Version("0.0"));
List<Content> appContent = appMeta.getApplicationContents();
assertEquals(2, appContent.size());
Content fbw = new ContentImpl("hello.world.jar;version=\"[1.1.0, 1.1.0]\"");
Content mbl = new ContentImpl("helloWorld.war;version=\"[0.0.0, 0.0.0]\"");
assertTrue(appContent.contains(fbw));
assertTrue(appContent.contains(mbl));
DeploymentMetadata dm = app.getDeploymentMetadata();
List<DeploymentContent> dcList = dm.getApplicationDeploymentContents();
assertEquals(2, dcList.size());
DeploymentContent dc1 = new DeploymentContentImpl("hello.world.jar;deployed-version=1.1.0");
DeploymentContent dc2 = new DeploymentContentImpl("helloWorld.war;deployed-version=0.0.0");
DeploymentContent dc3 = new DeploymentContentImpl("a.handy.persistence.library;deployed-version=1.1.0");
assertTrue(dcList.contains(dc1));
assertTrue(dcList.contains(dc2));
dcList = dm.getApplicationProvisionBundles();
assertEquals(1, dcList.size());
assertTrue(dcList.contains(dc3));
assertEquals(2, app.getBundleInfo().size());
BundleInfo info;
info = findBundleInfo(app.getBundleInfo(), "hello.world.jar");
assertNotNull(info);
assertEquals("HelloWorldJar", info.getHeaders().get(Constants.BUNDLE_NAME));
info = findBundleInfo(app.getBundleInfo(), "helloWorld.war");
assertNotNull(info);
assertEquals("helloWorld.war", info.getHeaders().get(Constants.BUNDLE_NAME));
assertEquals("/test", info.getHeaders().get("Bundle-ContextPath"));
}
Aggregations