aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mahrw...@apache.org
Subject svn commit: r1136053 - in /aries/trunk/application: ./ application-modeller-common-test/ application-modeller-common-test/src/ application-modeller-common-test/src/test/ application-modeller-common-test/src/test/java/ application-modeller-common-test/s...
Date Wed, 15 Jun 2011 14:04:48 GMT
Author: mahrwald
Date: Wed Jun 15 14:04:47 2011
New Revision: 1136053

URL: http://svn.apache.org/viewvc?rev=1136053&view=rev
Log:
ARIES-676: Common up tests between modeller projects

Added:
    aries/trunk/application/application-modeller-common-test/
    aries/trunk/application/application-modeller-common-test/pom.xml
    aries/trunk/application/application-modeller-common-test/src/
    aries/trunk/application/application-modeller-common-test/src/test/
    aries/trunk/application/application-modeller-common-test/src/test/java/
      - copied from r1135727, aries/trunk/application/application-modeller/src/test/java/
    aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/ModellerTest.java
    aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyTest.java
    aries/trunk/application/application-modeller-common-test/src/test/resources/
      - copied from r1135727, aries/trunk/application/application-modeller/src/test/resources/
    aries/trunk/application/application-modeller-common-test/src/test/resources/test.bundle/
      - copied from r1135728, aries/trunk/application/application-modeller-standalone/src/test/resources/test.bundle/
Removed:
    aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyImplTest.java
    aries/trunk/application/application-modeller-standalone/src/test/
    aries/trunk/application/application-modeller/src/test/java/
    aries/trunk/application/application-modeller/src/test/resources/
Modified:
    aries/trunk/application/application-modeller-standalone/src/main/java/org/apache/aries/application/modelling/standalone/OfflineModellingFactory.java
    aries/trunk/application/pom.xml

Added: aries/trunk/application/application-modeller-common-test/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-common-test/pom.xml?rev=1136053&view=auto
==============================================================================
--- aries/trunk/application/application-modeller-common-test/pom.xml (added)
+++ aries/trunk/application/application-modeller-common-test/pom.xml Wed Jun 15 14:04:47 2011
@@ -0,0 +1,134 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries</groupId>
+        <artifactId>java5-parent</artifactId>
+        <version>0.4</version>
+        <relativePath />
+    </parent>
+
+    <groupId>org.apache.aries.application</groupId>
+    <artifactId>application-modeller-common-test</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache Aries Application Modelling tests</name>
+    <version>0.3.1-SNAPSHOT</version>
+    <description>
+      Modelling utilities for working with Aries Applications (distribution for offline use).
+    </description>
+
+     <scm>
+         <connection>scm:svn:http://svn.apache.org/repos/asf/aries/trunk/application/application-modeller-common-test</connection>
+         <developerConnection>scm:svn:https://svn.apache.org/repos/asf/aries/trunk/application/application-modeller-common-test</developerConnection>
+         <url>http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-common-test</url>
+     </scm>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>application-modeller-standalone</artifactId>
+            <version>0.3.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries</groupId>
+            <artifactId>org.apache.aries.util</artifactId>
+            <version>0.4-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.osgi</groupId>
+        	<artifactId>org.osgi.core</artifactId>
+        	<version>4.2.0</version>
+        	<scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.osgi</groupId>
+        	<artifactId>org.osgi.compendium</artifactId>
+        	<version>4.2.0</version>
+        	<scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.api</artifactId>
+            <version>0.3.1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.application</groupId>
+            <artifactId>org.apache.aries.application.modeller</artifactId>
+            <version>0.3.1-SNAPSHOT</version>
+            <exclusions>
+              <exclusion>
+                <groupId>org.apache.aries.blueprint</groupId>
+                <artifactId>org.apache.aries.blueprint.core</artifactId>
+              </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+          <groupId>org.apache.aries.application</groupId>
+          <artifactId>org.apache.aries.application.utils</artifactId>
+          <version>0.3.1-SNAPSHOT</version>
+          <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.apache.aries.blueprint</groupId>
+        	<artifactId>org.apache.aries.blueprint.api</artifactId>
+          <version>0.3.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>blueprint-parser</artifactId>
+            <version>0.4-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.testsupport</groupId>
+            <artifactId>org.apache.aries.testsupport.unit</artifactId>
+            <scope>test</scope>
+            <version>0.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.aries.blueprint</groupId>
+            <artifactId>org.apache.aries.blueprint.core</artifactId>
+            <version>0.3.2-SNAPSHOT</version>
+            <exclusions>
+              <exclusion>
+                <groupId>org.apache.aries.proxy</groupId>
+                <artifactId>org.apache.aries.proxy.api</artifactId>
+              </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+</project>

Added: aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/ModellerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/ModellerTest.java?rev=1136053&view=auto
==============================================================================
--- aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/ModellerTest.java
(added)
+++ aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/ModellerTest.java
Wed Jun 15 14:04:47 2011
@@ -0,0 +1,92 @@
+package org.apache.aries.application.modelling;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.aries.application.modelling.ExportedPackage;
+import org.apache.aries.application.modelling.ImportedPackage;
+import org.apache.aries.application.modelling.ImportedService;
+import org.apache.aries.application.modelling.ModelledResource;
+import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl;
+import org.apache.aries.application.modelling.impl.ModellingManagerImpl;
+import org.apache.aries.application.modelling.impl.ParserProxyTest;
+import org.apache.aries.application.modelling.standalone.OfflineModellingFactory;
+import org.apache.aries.mocks.BundleContextMock;
+import org.apache.aries.util.filesystem.FileSystem;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import static org.junit.Assert.*;
+
+@RunWith(Parameterized.class)
+public class ModellerTest {
+    
+    @Parameters
+    public static List<Object[]> getDifferentModelledResourceManagers() {
+        ModelledResourceManagerImpl manager = new ModelledResourceManagerImpl();
+        manager.setModellingManager(new ModellingManagerImpl());
+        manager.setParserProxy(ParserProxyTest.getMockParserServiceProxy());
+        
+        return Arrays.asList(new Object[][] {
+                {OfflineModellingFactory.getModelledResourceManager()},
+                {manager}
+        });
+    }
+    
+    @AfterClass
+    public static void cleanup() {
+        BundleContextMock.clear();
+    }
+    
+	private final ModelledResourceManager sut;
+	
+	public ModellerTest(ModelledResourceManager sut) {
+	    this.sut = sut;
+	}
+	
+	@Test
+	public void testParsingOfBundle() throws Exception {
+		URL pathToTestBundle = getClass().getClassLoader().getResource("test.bundle");
+		
+		ModelledResource resource = sut.getModelledResource(
+				"file:///some.uri", 
+				FileSystem.getFSRoot(new File(pathToTestBundle.toURI())));
+		
+		assertNotNull(resource);
+		
+		// sanity check that we have parsed the manifest and package imports / exports
+		
+		assertEquals("test.bundle", resource.getSymbolicName());
+		assertEquals("1.0.0", resource.getVersion());
+		assertEquals(1, resource.getExportedPackages().size());
+		assertEquals(3, resource.getImportedPackages().size());
+		
+		ImportedPackage pack = resource.getImportedPackages().iterator().next();
+		assertEquals("javax.jms", pack.getPackageName());
+		assertEquals("1.1.0", pack.getVersionRange());
+		
+		ExportedPackage epack = resource.getExportedPackages().iterator().next();
+		assertEquals("wibble", epack.getPackageName());
+		assertEquals("1.0.0", epack.getVersion());
+		
+		assertEquals("true", epack.getAttributes().get("directive:"));
+		
+		
+		// sanity check that we have parsed the services
+		
+		assertEquals(3, resource.getExportedServices().size());
+		assertEquals(1, resource.getImportedServices().size());
+		
+		ImportedService service = resource.getImportedServices().iterator().next();
+		assertEquals("foo.bar.MyInjectedService", service.getInterface());
+		assertTrue(service.isOptional());
+		assertFalse(service.isList());
+		assertEquals("anOptionalReference", service.getId());
+	}
+}

Added: aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyTest.java?rev=1136053&view=auto
==============================================================================
--- aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyTest.java
(added)
+++ aries/trunk/application/application-modeller-common-test/src/test/java/org/apache/aries/application/modelling/impl/ParserProxyTest.java
Wed Jun 15 14:04:47 2011
@@ -0,0 +1,244 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIESOR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.application.modelling.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.aries.application.modelling.ModellingManager;
+import org.apache.aries.application.modelling.ParsedServiceElements;
+import org.apache.aries.application.modelling.ParserProxy;
+import org.apache.aries.application.modelling.WrappedReferenceMetadata;
+import org.apache.aries.application.modelling.WrappedServiceMetadata;
+import org.apache.aries.application.modelling.standalone.OfflineModellingFactory;
+import org.apache.aries.blueprint.container.NamespaceHandlerRegistry;
+import org.apache.aries.blueprint.container.ParserServiceImpl;
+import org.apache.aries.blueprint.namespace.NamespaceHandlerRegistryImpl;
+import org.apache.aries.blueprint.services.ParserService;
+import org.apache.aries.mocks.BundleContextMock;
+import org.apache.aries.unittest.mocks.Skeleton;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.osgi.framework.BundleContext;
+
+@RunWith(Parameterized.class)
+public class ParserProxyTest {
+
+  @Parameters
+  public static List<Object[]> parserProxies() {
+    return Arrays.asList(new Object[][] {
+            {getMockParserServiceProxy()}, 
+            {OfflineModellingFactory.getOfflineParserProxy()}});
+  }
+  
+  public static ParserProxy getMockParserServiceProxy() {
+      BundleContext mockCtx = Skeleton.newMock(new BundleContextMock(), BundleContext.class);
+      NamespaceHandlerRegistry nhri = new NamespaceHandlerRegistryImpl (mockCtx);
+
+      ParserService parserService = new ParserServiceImpl(nhri);
+      mockCtx.registerService(ParserService.class.getName(), parserService, new Hashtable<String,
String>());
+      
+      ParserProxyImpl parserProxyService = new ParserProxyImpl();
+      parserProxyService.setParserService(parserService);
+      parserProxyService.setBundleContext(mockCtx);
+      parserProxyService.setModellingManager(new ModellingManagerImpl());
+      
+      return parserProxyService;
+  }
+  
+  @AfterClass
+  public static void teardown() { 
+    BundleContextMock.clear();
+  }
+  
+  private final ModellingManager _modellingManager;
+  private final ParserProxy _parserProxy;
+  private final File resourceDir;
+  
+  public ParserProxyTest(ParserProxy sut) throws IOException {
+	  _parserProxy = sut;
+	  _modellingManager = new ModellingManagerImpl();
+	  
+	  // make sure paths work in Eclipse as well as Maven
+	  if (new File(".").getCanonicalFile().getName().equals("target")) {
+	      resourceDir = new File("../src/test/resources");
+	  } else {
+	      resourceDir = new File("src/test/resources");
+	  }
+  }
+  
+  
+  @Test
+  public void basicTest1() throws Exception { 
+    File bpXml = new File (resourceDir, "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml");
+    File bp2Xml = new File (resourceDir, "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml");
+    List<URL> urls = new ArrayList<URL>();
+    urls.add ((bpXml.toURI()).toURL());
+    urls.add ((bp2Xml.toURI()).toURL());
+    
+    List<? extends WrappedServiceMetadata> results = _parserProxy.parse(urls);
+    assertTrue ("Four results expected, not " + results.size(), results.size() == 4);
+    
+    Set<WrappedServiceMetadata> resultSet = new HashSet<WrappedServiceMetadata>(results);
+    Set<WrappedServiceMetadata> expectedResults = getTest1ExpectedResults();
+    assertEquals ("Blueprint parsed xml is not as expected: " + resultSet.toString() + "
!= " + expectedResults,
+        resultSet, expectedResults);
+  }
+  
+  @Test
+  public void testParseAllServiceElements() throws Exception { 
+    File bpXml = new File (resourceDir, "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp.xml");
+    File bp2Xml = new File (resourceDir, "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bp2.xml");
+    
+    List<WrappedServiceMetadata> services = new ArrayList<WrappedServiceMetadata>();
+    List<WrappedReferenceMetadata> references = new ArrayList<WrappedReferenceMetadata>();
+    
+    FileInputStream fis = new FileInputStream (bpXml);
+    ParsedServiceElements bpelem = _parserProxy.parseAllServiceElements(fis); 
+    services.addAll(bpelem.getServices());
+    references.addAll(bpelem.getReferences());
+    
+    fis = new FileInputStream (bp2Xml);
+    bpelem = _parserProxy.parseAllServiceElements(fis); 
+    services.addAll(bpelem.getServices());
+    references.addAll(bpelem.getReferences());
+    
+    // We expect:
+    // bp.xml: 3 services and 2 references
+    // bp2.xml: 3 services and a reference list
+    //
+    assertTrue ("Six services expected, not " + services.size(), services.size() == 6);
+    assertTrue ("Three references expected, not " + references.size(), references.size()
== 3);
+    
+    Set<WrappedServiceMetadata> expectedServices = getTest2ExpectedServices();
+    // ServiceResultSet will contain some services with autogenerated names starting '.'
so we can't 
+    // use a straight Set.equals(). We could add the autogenerated names to the expected
results but instead
+    // let's test that differsOnlyByName() works
+    int serviceMatchesFound = 0;
+    for (WrappedServiceMetadata result : services) { 
+      Iterator<WrappedServiceMetadata> it = expectedServices.iterator();
+      while (it.hasNext()) { 
+        WrappedServiceMetadata next = it.next();
+        if (result.equals(next) || result.identicalOrDiffersOnlyByName(next)) { 
+          serviceMatchesFound++;
+          it.remove();
+        }
+      }
+    }
+    
+    assertEquals ("Parsed services are wrong: " + expectedServices + " unmatched ",
+        6, serviceMatchesFound);
+    
+    Set<WrappedReferenceMetadata> expectedReferences = getTest2ExpectedReferences();
+    Set<WrappedReferenceMetadata> results = new HashSet<WrappedReferenceMetadata>(references);
+    assertTrue ("Parsed references are not as we'd expected: " + results.toString() + " !=
" + expectedReferences,
+        results.equals(expectedReferences));
+  }
+  
+  @Test
+  public void checkMultiValues() throws Exception { 
+    File bpXml = new File (resourceDir, "appModeller/test1.eba/bundle1.jar/OSGI-INF/blueprint/bpMultiValues.xml");
+    List<WrappedServiceMetadata> services = new ArrayList<WrappedServiceMetadata>();
+    FileInputStream fis = new FileInputStream (bpXml);
+    ParsedServiceElements bpelem = _parserProxy.parseAllServiceElements(fis); 
+    services.addAll(bpelem.getServices());
+    
+    assertEquals ("Multi valued service not parsed correctly", services.size(), 1);
+    
+    WrappedServiceMetadata wsm = services.get(0);
+    Map<String, Object> props = wsm.getServiceProperties();
+    String [] intents = (String[]) props.get("service.intents");
+    
+    assertEquals ("Service.intents[0] wrong", intents[0], "propagatesTransaction");
+    assertEquals ("Service.intents[1] wrong", intents[1], "confidentiality");
+    
+  }
+  
+  // model
+  // <reference id="fromOutside" interface="foo.bar.MyInjectedService"/>
+  // <reference-list id="refList1" interface="my.logging.services" filter="(active=true)"/>
+  //
+  private Set<WrappedReferenceMetadata> getTest2ExpectedReferences() throws Exception
{ 
+    Set<WrappedReferenceMetadata> expectedResults = new HashSet<WrappedReferenceMetadata>();
+         
+    expectedResults.add(_modellingManager.getImportedService(false, "foo.bar.MyInjectedService",
null, 
+        null, "fromOutside", false));
+    expectedResults.add(_modellingManager.getImportedService(true, "foo.bar.MyInjectedService",
null, 
+        null, "anotherOptionalReference", false));
+    expectedResults.add(_modellingManager.getImportedService(false, "my.logging.service",
null, "(&(trace=on)(debug=true))", "refList1", true));
+    
+    return expectedResults;
+  }
+  
+  // Test 2 includes anonymous services: the expected results are a superset of test1
+  private Set<WrappedServiceMetadata> getTest2ExpectedServices() { 
+    Set<WrappedServiceMetadata> expectedResults = getTest1ExpectedResults();
+        
+    expectedResults.add(_modellingManager.getExportedService("", 0, Arrays.asList("foo.bar.AnonService"),
null));
+    expectedResults.add(_modellingManager.getExportedService("", 0, Arrays.asList("foo.bar.NamedInnerBeanService"),
null));
+    return expectedResults;
+  }
+  
+  private Set<WrappedServiceMetadata> getTest1ExpectedResults() { 
+    Set<WrappedServiceMetadata> expectedResults = new HashSet<WrappedServiceMetadata>();
+    Map<String, Object> props = new HashMap<String, Object>();
+    props.put ("priority", "9");
+    props.put("volume", "11");
+    props.put("osgi.service.blueprint.compname", "myBean");
+    expectedResults.add(_modellingManager.getExportedService("myService", 0, Arrays.asList("foo.bar.MyService"),
props));
+
+    props = new HashMap<String, Object>();
+    props.put ("priority", "7");
+    props.put ("volume", "11");
+    props.put ("osgi.service.blueprint.compname", "bean1");
+    expectedResults.add(_modellingManager.getExportedService("service1.should.be.exported",
0, Arrays.asList("foo.bar.MyService"), props));
+ 
+    props = new HashMap<String, Object>();
+    props.put ("customer", "pig");
+    props.put ("osgi.service.blueprint.compname", "bean2");
+    expectedResults.add(_modellingManager.getExportedService("service2.should.not.be.exported",
0, Arrays.asList("com.acme.Delivery"), props));
+        
+    props = new HashMap<String, Object>();
+    props.put ("customer", "pig");
+    props.put ("target", "rabbit");
+    props.put ("payload", "excessive");
+    props.put ("osgi.service.blueprint.compname", "bean3");
+    expectedResults.add(_modellingManager.getExportedService("bean3", 0, Arrays.asList("com.acme.Delivery"),
props));
+       
+    return expectedResults;
+  } 
+}

Modified: aries/trunk/application/application-modeller-standalone/src/main/java/org/apache/aries/application/modelling/standalone/OfflineModellingFactory.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-modeller-standalone/src/main/java/org/apache/aries/application/modelling/standalone/OfflineModellingFactory.java?rev=1136053&r1=1136052&r2=1136053&view=diff
==============================================================================
--- aries/trunk/application/application-modeller-standalone/src/main/java/org/apache/aries/application/modelling/standalone/OfflineModellingFactory.java
(original)
+++ aries/trunk/application/application-modeller-standalone/src/main/java/org/apache/aries/application/modelling/standalone/OfflineModellingFactory.java
Wed Jun 15 14:04:47 2011
@@ -11,6 +11,7 @@ import java.util.Set;
 import javax.xml.validation.Schema;
 
 import org.apache.aries.application.modelling.ModelledResourceManager;
+import org.apache.aries.application.modelling.ParserProxy;
 import org.apache.aries.application.modelling.impl.AbstractParserProxy;
 import org.apache.aries.application.modelling.impl.ModelledResourceManagerImpl;
 import org.apache.aries.application.modelling.impl.ModellingManagerImpl;
@@ -69,25 +70,34 @@ public class OfflineModellingFactory {
 	
 	
 	private static class OfflineParserProxy extends AbstractParserProxy {
-		private final Parser parser = new Parser();
-		
 		protected ComponentDefinitionRegistry parseCDR(List<URL> blueprintsToParse) throws
Exception {
+			Parser parser = new Parser();
 			parser.parse(blueprintsToParse);
-			return getCDR();
+			return getCDR(parser);
 		}
 			
 		protected ComponentDefinitionRegistry parseCDR(InputStream blueprintToParse) throws Exception
{
+			Parser parser = new Parser();
 			parser.parse(blueprintToParse);
-			return getCDR();
+			return getCDR(parser);
 		}
 		
-		private ComponentDefinitionRegistry getCDR() {
+		private ComponentDefinitionRegistry getCDR(Parser parser) {
 			ComponentDefinitionRegistry cdr = new ComponentDefinitionRegistryImpl();
 			parser.populate(DUMMY_HANDLER_SET, cdr);
 			return cdr;			
 		}
 	};
 	
+	public static ParserProxy getOfflineParserProxy() {
+		ModellingManagerImpl modellingManager = new ModellingManagerImpl();
+		
+		OfflineParserProxy parserProxy = new OfflineParserProxy();
+		parserProxy.setModellingManager(modellingManager);
+		
+		return parserProxy;
+	}
+	
 	public static ModelledResourceManager getModelledResourceManager() {
 		ModellingManagerImpl modellingManager = new ModellingManagerImpl();
 		

Modified: aries/trunk/application/pom.xml
URL: http://svn.apache.org/viewvc/aries/trunk/application/pom.xml?rev=1136053&r1=1136052&r2=1136053&view=diff
==============================================================================
--- aries/trunk/application/pom.xml (original)
+++ aries/trunk/application/pom.xml Wed Jun 15 14:04:47 2011
@@ -46,6 +46,7 @@
       <module>application-management</module>
       <module>application-modeller</module>
       <module>application-modeller-standalone</module>
+      <module>application-modeller-common-test</module>
       <module>application-noop-resolver</module>
       <module>application-obr-resolver</module>
       <module>application-runtime</module>



Mime
View raw message