Author: rmannibucau Date: Sun Apr 20 17:50:41 2014 New Revision: 1588802 URL: http://svn.apache.org/r1588802 Log: adding openejb-junit.properties as default implicit config for EJBContainerRule and runner
Added: tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerDefaultConfig.java - copied, changed from r1588793, tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerRuleSimpleRule.java tomee/tomee/trunk/container/openejb-junit/src/test/resources/openejb-junit.properties Modified: tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/jee/statement/StartingStatement.java Modified: tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/jee/statement/StartingStatement.java URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/jee/statement/StartingStatement.java?rev=1588802&r1=1588801&r2=1588802&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/jee/statement/StartingStatement.java (original) +++ tomee/tomee/trunk/container/openejb-junit/src/main/java/org/apache/openejb/junit/jee/statement/StartingStatement.java Sun Apr 20 17:50:41 2014 @@ -30,7 +30,6 @@ import javax.naming.Context; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -import java.util.Map; public class StartingStatement extends DecoratingStatement { private final Class<?> clazz; @@ -57,6 +56,14 @@ public class StartingStatement extends D properties.put(OpenEjbContainer.Provider.OPENEJB_ADDITIONNAL_CALLERS_KEY, b.toString()); } + // default implicit config + { + final InputStream is = clazz.getClassLoader().getResourceAsStream("openejb-junit.properties"); + if (is != null) { + properties.load(is); + } + } + final PropertyFile propertyFile = clazz.getAnnotation(PropertyFile.class); if (propertyFile != null) { final String path = propertyFile.value(); @@ -71,11 +78,7 @@ public class StartingStatement extends D } } - final java.util.Properties fileProps = new java.util.Properties(); - fileProps.load(is); - for (final Map.Entry<Object, Object> entry : fileProps.entrySet()) { - properties.put(entry.getKey().toString(), entry.getValue().toString()); - } + properties.load(is); } } Copied: tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerDefaultConfig.java (from r1588793, tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerRuleSimpleRule.java) URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerDefaultConfig.java?p2=tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerDefaultConfig.java&p1=tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerRuleSimpleRule.java&r1=1588793&r2=1588802&rev=1588802&view=diff ============================================================================== --- tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerRuleSimpleRule.java (original) +++ tomee/tomee/trunk/container/openejb-junit/src/test/java/org/apache/openejb/junit/TestEJBContainerDefaultConfig.java Sun Apr 20 17:50:41 2014 @@ -35,37 +35,15 @@ import static org.junit.Assert.assertNot @Property(key = DeploymentFilterable.CLASSPATH_EXCLUDE, value = "jar:.*"), @Property(key = DeploymentFilterable.CLASSPATH_INCLUDE, value = ".*openejb-junit.*") }) -public class TestEJBContainerRuleSimpleRule { +public class TestEJBContainerDefaultConfig { @Rule public final EJBContainerRule containerRule = new EJBContainerRule(this); @org.apache.openejb.junit.jee.resources.TestResource - private Context ctx; - - @org.apache.openejb.junit.jee.resources.TestResource private java.util.Properties props; - @org.apache.openejb.junit.jee.resources.TestResource - private EJBContainer container; - - @EJB - private BasicEjbLocal ejb; - - private void doChecks() { - assertNotNull(ctx); - assertNotNull(props); - assertNotNull(container); - assertNotNull(ejb); - assertEquals("a b", ejb.concat("a", "b")); - } - - @Test - public void checkAllIsFine() { - doChecks(); - } - @Test - public void checkAllIsStillFine() { - doChecks(); + public void configIsHere() { + assertEquals("true", props.getProperty("implicit-config")); } } Added: tomee/tomee/trunk/container/openejb-junit/src/test/resources/openejb-junit.properties URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-junit/src/test/resources/openejb-junit.properties?rev=1588802&view=auto ============================================================================== --- tomee/tomee/trunk/container/openejb-junit/src/test/resources/openejb-junit.properties (added) +++ tomee/tomee/trunk/container/openejb-junit/src/test/resources/openejb-junit.properties Sun Apr 20 17:50:41 2014 @@ -0,0 +1,17 @@ +# +# 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. +# +implicit-config = true