Search in sources :

Example 1 with ApplicationMetadataFactory

use of org.apache.aries.application.ApplicationMetadataFactory 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")));
}
Also used : ApplicationMetadata(org.apache.aries.application.ApplicationMetadata) HashMap(java.util.HashMap) Content(org.apache.aries.application.Content) ServiceDeclaration(org.apache.aries.application.ServiceDeclaration) ApplicationMetadataFactory(org.apache.aries.application.ApplicationMetadataFactory) ApplicationMetadataFactoryImpl(org.apache.aries.application.impl.ApplicationMetadataFactoryImpl) Test(org.junit.Test)

Example 2 with ApplicationMetadataFactory

use of org.apache.aries.application.ApplicationMetadataFactory in project aries by apache.

the class ApplicationMetadataImplTest method testBasicMetadataCreation.

@Test
public void testBasicMetadataCreation() throws IOException {
    ApplicationMetadataFactory manager = new ApplicationMetadataFactoryImpl();
    ApplicationMetadata app = manager.parseApplicationMetadata(getClass().getResourceAsStream("/META-INF/APPLICATION.MF"));
    Assert.assertEquals("Travel Reservation", app.getApplicationName());
}
Also used : ApplicationMetadata(org.apache.aries.application.ApplicationMetadata) ApplicationMetadataFactory(org.apache.aries.application.ApplicationMetadataFactory) ApplicationMetadataFactoryImpl(org.apache.aries.application.impl.ApplicationMetadataFactoryImpl) Test(org.junit.Test)

Aggregations

ApplicationMetadata (org.apache.aries.application.ApplicationMetadata)2 ApplicationMetadataFactory (org.apache.aries.application.ApplicationMetadataFactory)2 ApplicationMetadataFactoryImpl (org.apache.aries.application.impl.ApplicationMetadataFactoryImpl)2 Test (org.junit.Test)2 HashMap (java.util.HashMap)1 Content (org.apache.aries.application.Content)1 ServiceDeclaration (org.apache.aries.application.ServiceDeclaration)1