You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2014/10/06 13:00:59 UTC

svn commit: r1629614 - in /aries/trunk/blueprint/blueprint-itests/src/test: java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java resources/IgnoreUnknownNamespaceTest.xml

Author: cschneider
Date: Mon Oct  6 11:00:58 2014
New Revision: 1629614

URL: http://svn.apache.org/r1629614
Log:
Simplify blueprint itest ParserServiceIgnoreUnknownNamespaceHandlerTest

Added:
    aries/trunk/blueprint/blueprint-itests/src/test/resources/IgnoreUnknownNamespaceTest.xml
Modified:
    aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java

Modified: aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java?rev=1629614&r1=1629613&r2=1629614&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java (original)
+++ aries/trunk/blueprint/blueprint-itests/src/test/java/org/apache/aries/blueprint/itests/ParserServiceIgnoreUnknownNamespaceHandlerTest.java Mon Oct  6 11:00:58 2014
@@ -18,21 +18,21 @@
  */
 package org.apache.aries.blueprint.itests;
 
+import static org.apache.aries.blueprint.itests.Helper.blueprintBundles;
+import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
+import static org.ops4j.pax.exam.CoreOptions.keepCaches;
+import static org.ops4j.pax.exam.CoreOptions.streamBundle;
+
 import java.io.InputStream;
 import java.net.URL;
 
-import javax.inject.Inject;
-
 import org.apache.aries.blueprint.itests.cm.service.Foo;
 import org.apache.aries.blueprint.itests.cm.service.FooFactory;
 import org.apache.aries.blueprint.itests.cm.service.FooInterface;
 import org.apache.aries.blueprint.services.ParserService;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.TestName;
-import org.ops4j.pax.exam.CoreOptions;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.ProbeBuilder;
 import org.ops4j.pax.exam.TestProbeBuilder;
@@ -42,46 +42,49 @@ import org.osgi.framework.Constants;
 
 
 public class ParserServiceIgnoreUnknownNamespaceHandlerTest extends AbstractBlueprintIntegrationTest {
-	private static final String CM_BUNDLE = "org.apache.aries.blueprint.cm";
-	private static final String TEST_BUNDLE = "org.apache.aries.blueprint.cm.test.b1";
-	
-	@ProbeBuilder
-	public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
-		probe.setHeader(Constants.EXPORT_PACKAGE, Foo.class.getPackage().getName());
-    	probe.setHeader(Constants.IMPORT_PACKAGE, Foo.class.getPackage().getName());
-		return probe;
-	}
+    private static final String CM_BUNDLE = "org.apache.aries.blueprint.cm";
+    private static final String TEST_BUNDLE = "org.apache.aries.blueprint.cm.test.b1";
+
+    @ProbeBuilder
+    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+        probe.setHeader(Constants.EXPORT_PACKAGE, Foo.class.getPackage().getName());
+        probe.setHeader(Constants.IMPORT_PACKAGE, Foo.class.getPackage().getName());
+        return probe;
+    }
 
     @org.ops4j.pax.exam.Configuration
     public Option[] config() {
-    	InputStream testBundle = TinyBundles.bundle()
+        InputStream testBundle = createTestBundle();
+        return new Option[] {
+            baseOptions(),
+            frameworkProperty("org.apache.aries.blueprint.parser.service.ignore.unknown.namespace.handlers").value("true"),
+            blueprintBundles(),
+            keepCaches(),
+            streamBundle(testBundle)
+        };
+    }
+
+    private InputStream createTestBundle() {
+        return TinyBundles.bundle()
     		.add(FooInterface.class)
     		.add(Foo.class)
     		.add(FooFactory.class)
-    		.add("OSGI-INF/blueprint/context.xml", 
-    				getResource("ManagedServiceFactoryTest.xml"))
+    		.add("OSGI-INF/blueprint/context.xml", getResource("IgnoreUnknownNamespaceTest.xml"))
     		.set(Constants.BUNDLE_SYMBOLICNAME, TEST_BUNDLE)
     		.set(Constants.EXPORT_PACKAGE, Foo.class.getPackage().getName())
     		.set(Constants.IMPORT_PACKAGE, Foo.class.getPackage().getName())
     		.build(TinyBundles.withBnd());
-    	return new Option[] {
-    			baseOptions(),
-                CoreOptions.frameworkProperty("org.apache.aries.blueprint.parser.service.ignore.unknown.namespace.handlers").value("true"),
-    			Helper.blueprintBundles(),
-    			CoreOptions.keepCaches(),
-    			CoreOptions.streamBundle(testBundle)
-    	};
-    }
-
-	@Before
-	public void stopCM() throws BundleException {
-		context().getBundleByName(CM_BUNDLE).stop();
-	}
-
-	@After
-	public void startCM() throws BundleException {
-		context().getBundleByName(CM_BUNDLE).start();
-	}
+    }
+
+    @Before
+    public void stopCM() throws BundleException {
+        context().getBundleByName(CM_BUNDLE).stop();
+    }
+
+    @After
+    public void startCM() throws BundleException {
+        context().getBundleByName(CM_BUNDLE).start();
+    }
 
     @Test
     public void testIgnoreTrue() throws Exception {

Added: aries/trunk/blueprint/blueprint-itests/src/test/resources/IgnoreUnknownNamespaceTest.xml
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-itests/src/test/resources/IgnoreUnknownNamespaceTest.xml?rev=1629614&view=auto
==============================================================================
--- aries/trunk/blueprint/blueprint-itests/src/test/resources/IgnoreUnknownNamespaceTest.xml (added)
+++ aries/trunk/blueprint/blueprint-itests/src/test/resources/IgnoreUnknownNamespaceTest.xml Mon Oct  6 11:00:58 2014
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+        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.
+    -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
+
+    <cm:cm-properties persistent-id=""/>
+
+    <bean class="org.apache.aries.blueprint.itests.cm.service.Foo"/>
+
+</blueprint>
\ No newline at end of file