use of org.apache.aries.application.impl.ApplicationMetadataFactoryImpl in project aries by apache.
the class ApplicationMetadataImplTest method testMetadataCreation.
@Test
public void testMetadataCreation() throws Exception {
ApplicationMetadataFactory manager = new ApplicationMetadataFactoryImpl();
ApplicationMetadata app = manager.parseApplicationMetadata(getClass().getResourceAsStream("/META-INF/APPLICATION4.MF"));
assertEquals("Travel Reservation", app.getApplicationName());
assertEquals("com.travel.reservation", app.getApplicationSymbolicName());
assertEquals(Version.parseVersion("1.2.0"), app.getApplicationVersion());
List<Content> appContents = app.getApplicationContents();
assertEquals(2, appContents.size());
Content appContent1 = new ContentImpl("com.travel.reservation.business");
Map<String, String> attrs = new HashMap<String, String>();
attrs.put("version", "\"[1.1.0,1.2.0)\"");
Content appContent2 = new ContentImpl("com.travel.reservation.web", attrs);
assertTrue(appContents.contains(appContent2));
assertTrue(appContents.contains(appContent1));
List<ServiceDeclaration> importedService = app.getApplicationImportServices();
assertEquals(2, importedService.size());
assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.flight.api")));
assertTrue(importedService.contains(new ServiceDeclarationImpl("com.travel.rail.api")));
List<ServiceDeclaration> exportedService = app.getApplicationExportServices();
assertTrue(exportedService.contains(new ServiceDeclarationImpl("com.travel.reservation")));
}
use of org.apache.aries.application.impl.ApplicationMetadataFactoryImpl in project aries by apache.
the class ManifestProcessorTest method testManifestWithoutEndingInNewLine.
@Test
public void testManifestWithoutEndingInNewLine() throws Exception {
ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION3.MF");
ApplicationMetadata am = manager.parseApplicationMetadata(in);
assertNotNull(am);
assertEquals("Wrong number of bundles are in the application", 1, am.getApplicationContents().size());
assertEquals("Wrong bundle name", "org.apache.aries.applications.test.bundle", am.getApplicationContents().get(0).getContentName());
}
use of org.apache.aries.application.impl.ApplicationMetadataFactoryImpl in project aries by apache.
the class AriesApplicationManagerImplTest method setup.
@Before
public void setup() {
_appMgr = new AriesApplicationManagerImpl();
_appMetaFactory = new ApplicationMetadataFactoryImpl();
DeploymentMetadataFactory dmf = new DeploymentMetadataFactoryImpl();
_converter = new DummyConverter();
List<BundleConverter> bundleConverters = new ArrayList<BundleConverter>();
bundleConverters.add(_converter);
_resolver = new DummyResolver();
_dmMgr = new DummyDMManager();
_dmMgr.setResolver(_resolver);
_appMgr.setApplicationMetadataFactory(_appMetaFactory);
_appMgr.setDeploymentMetadataFactory(dmf);
_appMgr.setBundleConverters(bundleConverters);
_appMgr.setDeploymentManifestManager(_dmMgr);
_appMgr.setLocalPlatform(new DummyLocalPlatform());
}
use of org.apache.aries.application.impl.ApplicationMetadataFactoryImpl in project aries by apache.
the class ManifestProcessorTest method testManifestMetadataWithMultiLineEntries.
/**
* Check metadata can be extracted from a manifest that uses multiple lines
* for a single manifest attribute.
*/
@Test
public void testManifestMetadataWithMultiLineEntries() throws Exception {
ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION2.MF");
ApplicationMetadata am = manager.parseApplicationMetadata(in);
assertNotNull(am);
assertEquals(am.getApplicationName(), appName);
//"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
List<Content> contents = am.getApplicationContents();
for (Content content : contents) {
if ("com.travel.reservation.web".equals(content.getContentName())) {
VersionRange vr = content.getVersion();
assertEquals(vr.getMinimumVersion(), new Version("1.1.0"));
assertEquals(vr.getMaximumVersion(), new Version("1.2.0"));
} else if ("com.travel.reservation.business".equals(content.getContentName())) {
VersionRange vr = content.getVersion();
assertEquals(new Version(0, 0, 0), vr.getMinimumVersion());
} else
fail("Unexepcted content name " + content.getContentName());
}
}
use of org.apache.aries.application.impl.ApplicationMetadataFactoryImpl in project aries by apache.
the class ManifestProcessorTest method testManifestMetadata.
/**
* Check metadata can be extracted from a simple manifest.
*/
@Test
public void testManifestMetadata() throws Exception {
ApplicationMetadataFactoryImpl manager = new ApplicationMetadataFactoryImpl();
InputStream in = getClass().getClassLoader().getResourceAsStream("META-INF/APPLICATION.MF");
ApplicationMetadata am = manager.parseApplicationMetadata(in);
assertNotNull(am);
assertEquals(am.getApplicationName(), appName);
//"com.travel.reservation.web;version=\"[1.1.0,1.2.0)\",com.travel.reservation.business",
List<Content> contents = am.getApplicationContents();
for (Content content : contents) {
if ("com.travel.reservation.web".equals(content.getContentName())) {
VersionRange vr = content.getVersion();
assertEquals(vr.getMinimumVersion(), new Version("1.1.0"));
assertEquals(vr.getMaximumVersion(), new Version("1.2.0"));
} else if ("com.travel.reservation.business".equals(content.getContentName())) {
VersionRange vr = content.getVersion();
assertEquals(new Version(0, 0, 0), vr.getMinimumVersion());
} else
fail("Unexepcted content name " + content.getContentName());
}
}
Aggregations