You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2015/11/23 23:07:58 UTC

[46/51] [partial] tomee git commit: removing ^M (windows eol)

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvokeMethod.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvokeMethod.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvokeMethod.java
index ca7a751..7ef0dbd 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvokeMethod.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/InvokeMethod.java
@@ -1,201 +1,201 @@
-/**
- * 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.
- */
-package org.apache.openejb.config.rules;
-
-import org.apache.openejb.assembler.classic.Assembler;
-import org.apache.openejb.assembler.classic.SecurityServiceInfo;
-import org.apache.openejb.assembler.classic.TransactionServiceInfo;
-import org.apache.openejb.config.AppModule;
-import org.apache.openejb.config.ConfigurationFactory;
-import org.apache.openejb.config.EjbModule;
-import org.apache.openejb.config.OutputGeneratedDescriptors;
-import org.apache.openejb.config.ValidationContext;
-import org.apache.openejb.config.ValidationFailedException;
-import org.apache.openejb.config.ValidationFailure;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.loader.SystemInstance;
-import org.apache.openejb.util.Join;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.ResourceBundle;
-import java.util.Set;
-
-import static org.apache.openejb.config.rules.ValidationAssertions.assertErrors;
-import static org.apache.openejb.config.rules.ValidationAssertions.assertFailures;
-import static org.apache.openejb.config.rules.ValidationAssertions.assertWarnings;
-import static org.junit.Assert.fail;
-
-/**
- * This Statement is the one which runs the test.
- */
-public class InvokeMethod extends Statement {
-    private ConfigurationFactory config;
-    private Assembler assembler;
-    // The test method
-    private final FrameworkMethod testMethod;
-    // The TestCase instance
-    private final Object target;
-    // These are all the keys defined in org.apache.openejb.config.rules.Messages.properties
-    private static final Set<String> allKeys;
-
-    static {
-        final ResourceBundle bundle = ResourceBundle.getBundle("org.apache.openejb.config.rules.Messages");
-        allKeys = bundle.keySet();
-    }
-
-    public InvokeMethod(final FrameworkMethod testMethod, final Object target) {
-        this.testMethod = testMethod;
-        this.target = target;
-    }
-
-    @Override
-    public void evaluate() throws Throwable {
-        final Map<Integer, List<String>> expectedKeys = validateKeys();
-        setUp();
-        final Object obj = testMethod.invokeExplosively(target);
-
-        final String outputDescriptors = SystemInstance.get().getProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
-        try {
-            SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
-
-            ValidationContext vc = null;
-            if (obj instanceof EjbJar) {
-                final EjbJar ejbJar = (EjbJar) obj;
-                final EjbModule ejbModule = new EjbModule(ejbJar);
-                vc = ejbModule.getValidation();
-                assembler.createApplication(config.configureApplication(ejbModule));
-            } else if (obj instanceof EjbModule) {
-                final EjbModule ejbModule = (EjbModule) obj;
-                vc = ejbModule.getValidation();
-                assembler.createApplication(config.configureApplication(ejbModule));
-            } else if (obj instanceof AppModule) {
-                final AppModule appModule = (AppModule) obj;
-                vc = appModule.getValidation();
-                assembler.createApplication(config.configureApplication(appModule));
-            }
-            if (!isEmpty(expectedKeys)) {
-                if (vc != null && expectedKeys.get(KeyType.FAILURE).isEmpty() && expectedKeys.get(KeyType.ERROR).isEmpty()) {
-                    if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
-                        assertWarnings(expectedKeys.get(KeyType.WARNING), new ValidationFailedException("", vc));
-                    }
-                } else {
-                    fail("A ValidationFailedException should have been thrown");
-                }
-            }
-        } catch (final ValidationFailedException vfe) {
-            if (!isEmpty(expectedKeys)) {
-                if (!expectedKeys.get(KeyType.FAILURE).isEmpty()) {
-                    assertFailures(expectedKeys.get(KeyType.FAILURE), vfe);
-                }
-                if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
-                    assertWarnings(expectedKeys.get(KeyType.WARNING), vfe);
-                }
-                if (!expectedKeys.get(KeyType.ERROR).isEmpty()) {
-                    assertErrors(expectedKeys.get(KeyType.ERROR), vfe);
-                }
-            } else {
-                for (final ValidationFailure failure : vfe.getFailures()) {
-                    System.out.println("failure = " + failure.getMessageKey());
-                }
-                fail("There should be no validation failures");
-            }
-        } finally {
-            SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, outputDescriptors);
-        }
-
-        tearDown();
-    }
-
-    private void setUp() throws Exception {
-        config = new ConfigurationFactory();
-        assembler = new Assembler();
-        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
-        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
-    }
-
-    private void tearDown() {
-    }
-
-    /**
-     * Tests to see if the keys specified in the @Keys annotation are also available in the org.apache.openejb.config.rules.Messages.properties file. If there are any invalid keys,
-     * then it throws an exception and causes the test to error out. If all the keys are valid, then it returns those keys. This list of keys can then be compared with all the Keys
-     * in org.apache.openejb.config.rules.Messages.properties and one can then find out the "test coverage" of the keys i.e. this tool can be used to find keys for which tests have
-     * not yet been written
-     *
-     * @return
-     * @throws Exception
-     */
-    private Map<Integer, List<String>> validateKeys() throws Exception {
-        final Keys annotation = testMethod.getAnnotation(Keys.class);
-        final Key[] keys = annotation.value();
-        final ArrayList<String> wrongKeys = new ArrayList<String>();
-        for (final Key key : keys) {
-            if (allKeys.contains("1." + key.value())) {
-                continue;
-            } else {
-                wrongKeys.add(key.value());
-            }
-        }
-        if (wrongKeys.isEmpty()) {
-            final Map<Integer, List<String>> validKeys = new HashMap<Integer, List<String>>();
-            final ArrayList<String> failureKeys = new ArrayList<String>();
-            final ArrayList<String> warningKeys = new ArrayList<String>();
-            final ArrayList<String> errorKeys = new ArrayList<String>();
-            for (final Key key : keys) {
-                for (int i = 0; i < key.count(); i++) {
-                    switch (key.type()) {
-                        case KeyType.FAILURE:
-                            failureKeys.add(key.value());
-                            break;
-                        case KeyType.WARNING:
-                            warningKeys.add(key.value());
-                            break;
-                        case KeyType.ERROR:
-                            errorKeys.add(key.value());
-                            break;
-                    }
-                }
-            }
-            validKeys.put(KeyType.FAILURE, failureKeys);
-            validKeys.put(KeyType.WARNING, warningKeys);
-            validKeys.put(KeyType.ERROR, errorKeys);
-            return validKeys;
-        } else {
-            final String commaDelimitedKeys = Join.join(",", wrongKeys);
-            throw new Exception("The following keys listed in the @Keys annotation on the method " + testMethod.getName() + "() of " + testMethod.getMethod().getDeclaringClass()
-                + " are invalid : " + commaDelimitedKeys
-                + " . Only keys listed in org.apache.openejb.config.rules.Messages.properties are allowed to be used in this annotation. ");
-        }
-    }
-
-    private boolean isEmpty(final Map<Integer, List<String>> expectedKeys) {
-        boolean empty = true;
-        final Set<Entry<Integer, List<String>>> entrySet = expectedKeys.entrySet();
-        for (final Entry<Integer, List<String>> entry : entrySet) {
-            empty = entry.getValue().size() == 0;
-            if (!empty)
-                return empty;
-        }
-        return empty;
-    }
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.config.rules;
+
+import org.apache.openejb.assembler.classic.Assembler;
+import org.apache.openejb.assembler.classic.SecurityServiceInfo;
+import org.apache.openejb.assembler.classic.TransactionServiceInfo;
+import org.apache.openejb.config.AppModule;
+import org.apache.openejb.config.ConfigurationFactory;
+import org.apache.openejb.config.EjbModule;
+import org.apache.openejb.config.OutputGeneratedDescriptors;
+import org.apache.openejb.config.ValidationContext;
+import org.apache.openejb.config.ValidationFailedException;
+import org.apache.openejb.config.ValidationFailure;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.loader.SystemInstance;
+import org.apache.openejb.util.Join;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.Statement;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import static org.apache.openejb.config.rules.ValidationAssertions.assertErrors;
+import static org.apache.openejb.config.rules.ValidationAssertions.assertFailures;
+import static org.apache.openejb.config.rules.ValidationAssertions.assertWarnings;
+import static org.junit.Assert.fail;
+
+/**
+ * This Statement is the one which runs the test.
+ */
+public class InvokeMethod extends Statement {
+    private ConfigurationFactory config;
+    private Assembler assembler;
+    // The test method
+    private final FrameworkMethod testMethod;
+    // The TestCase instance
+    private final Object target;
+    // These are all the keys defined in org.apache.openejb.config.rules.Messages.properties
+    private static final Set<String> allKeys;
+
+    static {
+        final ResourceBundle bundle = ResourceBundle.getBundle("org.apache.openejb.config.rules.Messages");
+        allKeys = bundle.keySet();
+    }
+
+    public InvokeMethod(final FrameworkMethod testMethod, final Object target) {
+        this.testMethod = testMethod;
+        this.target = target;
+    }
+
+    @Override
+    public void evaluate() throws Throwable {
+        final Map<Integer, List<String>> expectedKeys = validateKeys();
+        setUp();
+        final Object obj = testMethod.invokeExplosively(target);
+
+        final String outputDescriptors = SystemInstance.get().getProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
+        try {
+            SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, "false");
+
+            ValidationContext vc = null;
+            if (obj instanceof EjbJar) {
+                final EjbJar ejbJar = (EjbJar) obj;
+                final EjbModule ejbModule = new EjbModule(ejbJar);
+                vc = ejbModule.getValidation();
+                assembler.createApplication(config.configureApplication(ejbModule));
+            } else if (obj instanceof EjbModule) {
+                final EjbModule ejbModule = (EjbModule) obj;
+                vc = ejbModule.getValidation();
+                assembler.createApplication(config.configureApplication(ejbModule));
+            } else if (obj instanceof AppModule) {
+                final AppModule appModule = (AppModule) obj;
+                vc = appModule.getValidation();
+                assembler.createApplication(config.configureApplication(appModule));
+            }
+            if (!isEmpty(expectedKeys)) {
+                if (vc != null && expectedKeys.get(KeyType.FAILURE).isEmpty() && expectedKeys.get(KeyType.ERROR).isEmpty()) {
+                    if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
+                        assertWarnings(expectedKeys.get(KeyType.WARNING), new ValidationFailedException("", vc));
+                    }
+                } else {
+                    fail("A ValidationFailedException should have been thrown");
+                }
+            }
+        } catch (final ValidationFailedException vfe) {
+            if (!isEmpty(expectedKeys)) {
+                if (!expectedKeys.get(KeyType.FAILURE).isEmpty()) {
+                    assertFailures(expectedKeys.get(KeyType.FAILURE), vfe);
+                }
+                if (!expectedKeys.get(KeyType.WARNING).isEmpty()) {
+                    assertWarnings(expectedKeys.get(KeyType.WARNING), vfe);
+                }
+                if (!expectedKeys.get(KeyType.ERROR).isEmpty()) {
+                    assertErrors(expectedKeys.get(KeyType.ERROR), vfe);
+                }
+            } else {
+                for (final ValidationFailure failure : vfe.getFailures()) {
+                    System.out.println("failure = " + failure.getMessageKey());
+                }
+                fail("There should be no validation failures");
+            }
+        } finally {
+            SystemInstance.get().setProperty(OutputGeneratedDescriptors.OUTPUT_DESCRIPTORS, outputDescriptors);
+        }
+
+        tearDown();
+    }
+
+    private void setUp() throws Exception {
+        config = new ConfigurationFactory();
+        assembler = new Assembler();
+        assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
+        assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
+    }
+
+    private void tearDown() {
+    }
+
+    /**
+     * Tests to see if the keys specified in the @Keys annotation are also available in the org.apache.openejb.config.rules.Messages.properties file. If there are any invalid keys,
+     * then it throws an exception and causes the test to error out. If all the keys are valid, then it returns those keys. This list of keys can then be compared with all the Keys
+     * in org.apache.openejb.config.rules.Messages.properties and one can then find out the "test coverage" of the keys i.e. this tool can be used to find keys for which tests have
+     * not yet been written
+     *
+     * @return
+     * @throws Exception
+     */
+    private Map<Integer, List<String>> validateKeys() throws Exception {
+        final Keys annotation = testMethod.getAnnotation(Keys.class);
+        final Key[] keys = annotation.value();
+        final ArrayList<String> wrongKeys = new ArrayList<String>();
+        for (final Key key : keys) {
+            if (allKeys.contains("1." + key.value())) {
+                continue;
+            } else {
+                wrongKeys.add(key.value());
+            }
+        }
+        if (wrongKeys.isEmpty()) {
+            final Map<Integer, List<String>> validKeys = new HashMap<Integer, List<String>>();
+            final ArrayList<String> failureKeys = new ArrayList<String>();
+            final ArrayList<String> warningKeys = new ArrayList<String>();
+            final ArrayList<String> errorKeys = new ArrayList<String>();
+            for (final Key key : keys) {
+                for (int i = 0; i < key.count(); i++) {
+                    switch (key.type()) {
+                        case KeyType.FAILURE:
+                            failureKeys.add(key.value());
+                            break;
+                        case KeyType.WARNING:
+                            warningKeys.add(key.value());
+                            break;
+                        case KeyType.ERROR:
+                            errorKeys.add(key.value());
+                            break;
+                    }
+                }
+            }
+            validKeys.put(KeyType.FAILURE, failureKeys);
+            validKeys.put(KeyType.WARNING, warningKeys);
+            validKeys.put(KeyType.ERROR, errorKeys);
+            return validKeys;
+        } else {
+            final String commaDelimitedKeys = Join.join(",", wrongKeys);
+            throw new Exception("The following keys listed in the @Keys annotation on the method " + testMethod.getName() + "() of " + testMethod.getMethod().getDeclaringClass()
+                + " are invalid : " + commaDelimitedKeys
+                + " . Only keys listed in org.apache.openejb.config.rules.Messages.properties are allowed to be used in this annotation. ");
+        }
+    }
+
+    private boolean isEmpty(final Map<Integer, List<String>> expectedKeys) {
+        boolean empty = true;
+        final Set<Entry<Integer, List<String>>> entrySet = expectedKeys.entrySet();
+        for (final Entry<Integer, List<String>> entry : entrySet) {
+            empty = entry.getValue().size() == 0;
+            if (!empty)
+                return empty;
+        }
+        return empty;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Key.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Key.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Key.java
index edf64d5..06ec3bf 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Key.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Key.java
@@ -1,32 +1,32 @@
-/**
- * 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.
- */
-package org.apache.openejb.config.rules;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Key {
-    String value();
-
-    int count() default 1;
-
-    int type() default KeyType.FAILURE;
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.config.rules;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Key {
+    String value();
+
+    int count() default 1;
+
+    int type() default KeyType.FAILURE;
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Keys.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Keys.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Keys.java
index afda752..cb0dd09 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Keys.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/Keys.java
@@ -1,31 +1,31 @@
-/**
- * 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.
- */
-package org.apache.openejb.config.rules;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Used to specify the keys being tested.
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Keys {
-    Key[] value() default {};
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.config.rules;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Used to specify the keys being tested.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Keys {
+    Key[] value() default {};
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/config/rules/MistakenResourceRefUsageTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/MistakenResourceRefUsageTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/MistakenResourceRefUsageTest.java
index 0d4f4a0..6cce24f 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/MistakenResourceRefUsageTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/MistakenResourceRefUsageTest.java
@@ -1,55 +1,55 @@
-/**
- * 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.
- */
-package org.apache.openejb.config.rules;
-
-import org.apache.openejb.OpenEJBException;
-import org.apache.openejb.jee.EjbJar;
-import org.apache.openejb.jee.StatefulBean;
-import org.apache.openejb.jee.StatelessBean;
-import org.junit.runner.RunWith;
-
-import javax.annotation.Resource;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-
-@RunWith(ValidationRunner.class)
-public class MistakenResourceRefUsageTest {
-    @Keys({@Key(value = "resourceRef.onEntityManagerFactory", count = 2), @Key(value = "resourceRef.onEntityManager", count = 2),
-        @Key(value = "resourceAnnotation.onClassWithNoName", count = 2)})
-    public EjbJar wrongUsage() throws OpenEJBException {
-        final EjbJar ejbJar = new EjbJar();
-        ejbJar.addEnterpriseBean(new StatelessBean(FooStateless.class));
-        ejbJar.addEnterpriseBean(new StatefulBean(FooStateful.class));
-        return ejbJar;
-    }
-
-    @Resource
-    private static class FooStateless {
-        @Resource
-        EntityManagerFactory emf;
-        @Resource
-        EntityManager em;
-    }
-
-    @Resource
-    private static class FooStateful {
-        @Resource
-        EntityManagerFactory emf;
-        @Resource
-        EntityManager em;
-    }
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.config.rules;
+
+import org.apache.openejb.OpenEJBException;
+import org.apache.openejb.jee.EjbJar;
+import org.apache.openejb.jee.StatefulBean;
+import org.apache.openejb.jee.StatelessBean;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+
+@RunWith(ValidationRunner.class)
+public class MistakenResourceRefUsageTest {
+    @Keys({@Key(value = "resourceRef.onEntityManagerFactory", count = 2), @Key(value = "resourceRef.onEntityManager", count = 2),
+        @Key(value = "resourceAnnotation.onClassWithNoName", count = 2)})
+    public EjbJar wrongUsage() throws OpenEJBException {
+        final EjbJar ejbJar = new EjbJar();
+        ejbJar.addEnterpriseBean(new StatelessBean(FooStateless.class));
+        ejbJar.addEnterpriseBean(new StatefulBean(FooStateful.class));
+        return ejbJar;
+    }
+
+    @Resource
+    private static class FooStateless {
+        @Resource
+        EntityManagerFactory emf;
+        @Resource
+        EntityManager em;
+    }
+
+    @Resource
+    private static class FooStateful {
+        @Resource
+        EntityManagerFactory emf;
+        @Resource
+        EntityManager em;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/config/rules/ValidationRunner.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/ValidationRunner.java b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/ValidationRunner.java
index d07cf52a..7b2d4ee 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/config/rules/ValidationRunner.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/rules/ValidationRunner.java
@@ -1,88 +1,88 @@
-/**
- * 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.
- */
-package org.apache.openejb.config.rules;
-
-import org.junit.Test;
-import org.junit.internal.runners.model.ReflectiveCallable;
-import org.junit.internal.runners.statements.Fail;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-import java.util.List;
-
-/**
- * This class is created specifically to write tests which test OpenEjb validation code. Specifically, it is used to check the usage of keys defined in
- * org.apache.openejb.config.rules.Messages.properties. To use this runner, simply annotate your test case with @RunWith(ValidationRunner.class). Here are some things to keep in
- * mind when writing tests: 1. A test method needs to be annotated with org.apache.openejb.config.rules.Keys instead of the org.junit.Test 2. Any usage of the @Test annotation will
- * be ignored 3. If the @Keys and @Test annotation are used together on a test method, then the TestCase will error out 4. Every test method should create a EjbJar and return it
- * from the method. It should list the keys being tested in the @Keys annotation 5. The runner will invoke the test method and use the Assembler and ConfigurationFactory to create
- * the application 6. This will kick off validation and this Runner will catch ValidationFailureException and make sure that all the keys specified in the @Keys annotation show up
- * in the ValidationFailureException 7. If the keys listed in the @Keys annotation match the keys found in the ValidationFailureException, the test passes, else the test fails. 8.
- * This Runner also validates that the keys specified in the @Keys annotation are also available in the org.apache.openejb.config.rules.Messages.properties file. If the key is not
- * found, then the Runner throws and exception resulting in your test case not being allowed to run. Sometimes you want to write a test where you do not want any
- * ValidationFailureException to be thrown, in those scenarios, simply annotate your test with @Keys and do not specify any @Key in it
- */
-public class ValidationRunner extends BlockJUnit4ClassRunner {
-    public ValidationRunner(final Class<?> klass) throws InitializationError {
-        super(klass);
-    }
-
-    /**
-     * Flags an error if you have annotated a test with both @Test and @Keys. Any method annotated with @Test will be ignored anyways.
-     */
-    @Override
-    protected void collectInitializationErrors(final List<Throwable> errors) {
-        super.collectInitializationErrors(errors);
-        final List<FrameworkMethod> methodsAnnotatedWithKeys = getTestClass().getAnnotatedMethods(Keys.class);
-        for (final FrameworkMethod frameworkMethod : methodsAnnotatedWithKeys) {
-            if (frameworkMethod.getAnnotation(Test.class) != null) {
-                final String gripe = "The method " + frameworkMethod.getName() + "() can only be annotated with @Keys";
-                errors.add(new Exception(gripe));
-            }
-        }
-    }
-
-    @Override
-    protected Statement methodBlock(final FrameworkMethod method) {
-        final Object test;
-        try {
-            test = new ReflectiveCallable() {
-                @Override
-                protected Object runReflectiveCall() throws Throwable {
-                    return createTest();
-                }
-            }.run();
-        } catch (final Throwable e) {
-            return new Fail(e);
-        }
-        Statement statement = new InvokeMethod(method, test);
-        statement = withBefores(method, test, statement);
-        statement = withAfters(method, test, statement);
-        return statement;
-    }
-
-    /**
-     * By default JUnit includes all methods annotated with @Test. This method only allows methods annotated with @Keys to be included in the list of methods to be run in a
-     * TestCase. Any @Test methods will be ignored
-     */
-    @Override
-    protected List<FrameworkMethod> computeTestMethods() {
-        return getTestClass().getAnnotatedMethods(Keys.class);
-    }
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.config.rules;
+
+import org.junit.Test;
+import org.junit.internal.runners.model.ReflectiveCallable;
+import org.junit.internal.runners.statements.Fail;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.FrameworkMethod;
+import org.junit.runners.model.InitializationError;
+import org.junit.runners.model.Statement;
+
+import java.util.List;
+
+/**
+ * This class is created specifically to write tests which test OpenEjb validation code. Specifically, it is used to check the usage of keys defined in
+ * org.apache.openejb.config.rules.Messages.properties. To use this runner, simply annotate your test case with @RunWith(ValidationRunner.class). Here are some things to keep in
+ * mind when writing tests: 1. A test method needs to be annotated with org.apache.openejb.config.rules.Keys instead of the org.junit.Test 2. Any usage of the @Test annotation will
+ * be ignored 3. If the @Keys and @Test annotation are used together on a test method, then the TestCase will error out 4. Every test method should create a EjbJar and return it
+ * from the method. It should list the keys being tested in the @Keys annotation 5. The runner will invoke the test method and use the Assembler and ConfigurationFactory to create
+ * the application 6. This will kick off validation and this Runner will catch ValidationFailureException and make sure that all the keys specified in the @Keys annotation show up
+ * in the ValidationFailureException 7. If the keys listed in the @Keys annotation match the keys found in the ValidationFailureException, the test passes, else the test fails. 8.
+ * This Runner also validates that the keys specified in the @Keys annotation are also available in the org.apache.openejb.config.rules.Messages.properties file. If the key is not
+ * found, then the Runner throws and exception resulting in your test case not being allowed to run. Sometimes you want to write a test where you do not want any
+ * ValidationFailureException to be thrown, in those scenarios, simply annotate your test with @Keys and do not specify any @Key in it
+ */
+public class ValidationRunner extends BlockJUnit4ClassRunner {
+    public ValidationRunner(final Class<?> klass) throws InitializationError {
+        super(klass);
+    }
+
+    /**
+     * Flags an error if you have annotated a test with both @Test and @Keys. Any method annotated with @Test will be ignored anyways.
+     */
+    @Override
+    protected void collectInitializationErrors(final List<Throwable> errors) {
+        super.collectInitializationErrors(errors);
+        final List<FrameworkMethod> methodsAnnotatedWithKeys = getTestClass().getAnnotatedMethods(Keys.class);
+        for (final FrameworkMethod frameworkMethod : methodsAnnotatedWithKeys) {
+            if (frameworkMethod.getAnnotation(Test.class) != null) {
+                final String gripe = "The method " + frameworkMethod.getName() + "() can only be annotated with @Keys";
+                errors.add(new Exception(gripe));
+            }
+        }
+    }
+
+    @Override
+    protected Statement methodBlock(final FrameworkMethod method) {
+        final Object test;
+        try {
+            test = new ReflectiveCallable() {
+                @Override
+                protected Object runReflectiveCall() throws Throwable {
+                    return createTest();
+                }
+            }.run();
+        } catch (final Throwable e) {
+            return new Fail(e);
+        }
+        Statement statement = new InvokeMethod(method, test);
+        statement = withBefores(method, test, statement);
+        statement = withAfters(method, test, statement);
+        return statement;
+    }
+
+    /**
+     * By default JUnit includes all methods annotated with @Test. This method only allows methods annotated with @Keys to be included in the list of methods to be run in a
+     * TestCase. Any @Test methods will be ignored
+     */
+    @Override
+    protected List<FrameworkMethod> computeTestMethods() {
+        return getTestClass().getAnnotatedMethods(Keys.class);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/core/security/PermitAllWithDenyAllOnClassTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/core/security/PermitAllWithDenyAllOnClassTest.java b/container/openejb-core/src/test/java/org/apache/openejb/core/security/PermitAllWithDenyAllOnClassTest.java
index 9bd27e2..c37baf7 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/core/security/PermitAllWithDenyAllOnClassTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/core/security/PermitAllWithDenyAllOnClassTest.java
@@ -1,88 +1,88 @@
-/**
- * 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.
- */
-package org.apache.openejb.core.security;
-
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Module;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.annotation.security.DenyAll;
-import javax.annotation.security.PermitAll;
-import javax.ejb.EJB;
-import javax.ejb.EJBAccessException;
-import javax.ejb.Singleton;
-
-@RunWith(ApplicationComposer.class)
-public class PermitAllWithDenyAllOnClassTest {
-    @Module
-    public Class<?>[] beans() {
-        return new Class<?>[]{DenyAllow.class, AllowDeny.class};
-    }
-
-    @EJB
-    private DenyAllow denyAllow;
-
-    @EJB
-    private AllowDeny allowDeny;
-
-    @Test
-    public void allowed() {
-        denyAllow.allowed();
-    }
-
-    @Test(expected = EJBAccessException.class)
-    public void forbidden() {
-        denyAllow.forbidden();
-    }
-
-    @Test
-    public void allowed2() {
-        allowDeny.allowed();
-    }
-
-    @Test(expected = EJBAccessException.class)
-    public void forbidden2() {
-        allowDeny.forbidden();
-    }
-
-    @Singleton
-    @DenyAll
-    public static class DenyAllow {
-        @PermitAll
-        public void allowed() {
-            // no-op
-        }
-
-        public void forbidden() {
-            // no-op
-        }
-    }
-
-    @Singleton
-    @PermitAll
-    public static class AllowDeny {
-        public void allowed() {
-            // no-op
-        }
-
-        @DenyAll
-        public void forbidden() {
-            // no-op
-        }
-    }
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.core.security;
+
+import org.apache.openejb.junit.ApplicationComposer;
+import org.apache.openejb.testing.Module;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.security.DenyAll;
+import javax.annotation.security.PermitAll;
+import javax.ejb.EJB;
+import javax.ejb.EJBAccessException;
+import javax.ejb.Singleton;
+
+@RunWith(ApplicationComposer.class)
+public class PermitAllWithDenyAllOnClassTest {
+    @Module
+    public Class<?>[] beans() {
+        return new Class<?>[]{DenyAllow.class, AllowDeny.class};
+    }
+
+    @EJB
+    private DenyAllow denyAllow;
+
+    @EJB
+    private AllowDeny allowDeny;
+
+    @Test
+    public void allowed() {
+        denyAllow.allowed();
+    }
+
+    @Test(expected = EJBAccessException.class)
+    public void forbidden() {
+        denyAllow.forbidden();
+    }
+
+    @Test
+    public void allowed2() {
+        allowDeny.allowed();
+    }
+
+    @Test(expected = EJBAccessException.class)
+    public void forbidden2() {
+        allowDeny.forbidden();
+    }
+
+    @Singleton
+    @DenyAll
+    public static class DenyAllow {
+        @PermitAll
+        public void allowed() {
+            // no-op
+        }
+
+        public void forbidden() {
+            // no-op
+        }
+    }
+
+    @Singleton
+    @PermitAll
+    public static class AllowDeny {
+        public void allowed() {
+            // no-op
+        }
+
+        @DenyAll
+        public void forbidden() {
+            // no-op
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/jpa/JTAPuAndBmtTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/jpa/JTAPuAndBmtTest.java b/container/openejb-core/src/test/java/org/apache/openejb/jpa/JTAPuAndBmtTest.java
index cb03686..121c966 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/jpa/JTAPuAndBmtTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/jpa/JTAPuAndBmtTest.java
@@ -1,154 +1,154 @@
-/*
- * 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.
- */
-package org.apache.openejb.jpa;
-
-import org.apache.openejb.jee.Empty;
-import org.apache.openejb.jee.StatelessBean;
-import org.apache.openejb.jee.jpa.unit.Persistence;
-import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Configuration;
-import org.apache.openejb.testing.Module;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.annotation.Resource;
-import javax.ejb.EJB;
-import javax.ejb.EJBContext;
-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionManagement;
-import javax.ejb.TransactionManagementType;
-import javax.persistence.Entity;
-import javax.persistence.EntityManager;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.PersistenceContext;
-import javax.persistence.TypedQuery;
-import java.util.Properties;
-
-import static org.junit.Assert.assertNotNull;
-
-@RunWith(ApplicationComposer.class)
-public class JTAPuAndBmtTest {
-    @EJB
-    private BmtManager bmtManager;
-
-    @Configuration
-    public Properties config() {
-        final Properties p = new Properties();
-        p.put("JTAPuAndBmtTest", "new://Resource?type=DataSource");
-        p.put("JTAPuAndBmtTest.JdbcDriver", "org.hsqldb.jdbcDriver");
-        p.put("JTAPuAndBmtTest.JdbcUrl", "jdbc:hsqldb:mem:bval");
-        return p;
-    }
-
-    @Module
-    public StatelessBean app() throws Exception {
-        final StatelessBean bean = new StatelessBean(BmtManager.class);
-        bean.setLocalBean(new Empty());
-        return bean;
-    }
-
-    @Module
-    public Persistence persistence() {
-        final PersistenceUnit unit = new PersistenceUnit("foo-unit");
-        unit.addClass(TheEntity.class);
-        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
-        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
-        unit.setExcludeUnlistedClasses(true);
-
-        final Persistence persistence = new Persistence(unit);
-        persistence.setVersion("2.0");
-        return persistence;
-    }
-
-    @LocalBean
-    @Stateless
-    @TransactionManagement(TransactionManagementType.BEAN)
-    public static class BmtManager {
-        @PersistenceContext
-        private EntityManager em;
-
-        @Resource
-        private EJBContext ctx;
-
-        public TheEntity persist() {
-            try {
-                ctx.getUserTransaction().begin();
-                final TheEntity entity = new TheEntity();
-                entity.setName("name");
-                em.persist(entity);
-                ctx.getUserTransaction().commit();
-                return entity;
-            } catch (final Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-
-        public TheEntity findWithJpQl() {
-            final TypedQuery<TheEntity> query = em.createQuery("select e from JTAPuAndBmtTest$TheEntity e", TheEntity.class);
-            query.getResultList(); // to ensure we don't break OPENEJB-1443
-            return query.getResultList().iterator().next();
-        }
-
-        public void update(final TheEntity entity) {
-            entity.setName("new");
-            try {
-                ctx.getUserTransaction().begin();
-                em.merge(entity);
-                ctx.getUserTransaction().commit();
-            } catch (final Exception e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    @Entity
-    public static class TheEntity {
-        @Id
-        @GeneratedValue
-        private long id;
-        private String name;
-
-        public long getId() {
-            return id;
-        }
-
-        public void setId(final long i) {
-            id = i;
-        }
-
-        public String getName() {
-            return name;
-        }
-
-        public void setName(final String n) {
-            name = n;
-        }
-    }
-
-    @Test
-    public void valid() {
-        assertNotNull(bmtManager.persist());
-
-        final TheEntity entity = bmtManager.findWithJpQl();
-        assertNotNull(entity);
-
-        bmtManager.update(entity); // will throw an exception if any error
-    }
-}
+/*
+ * 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.
+ */
+package org.apache.openejb.jpa;
+
+import org.apache.openejb.jee.Empty;
+import org.apache.openejb.jee.StatelessBean;
+import org.apache.openejb.jee.jpa.unit.Persistence;
+import org.apache.openejb.jee.jpa.unit.PersistenceUnit;
+import org.apache.openejb.junit.ApplicationComposer;
+import org.apache.openejb.testing.Configuration;
+import org.apache.openejb.testing.Module;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.EJBContext;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.persistence.Entity;
+import javax.persistence.EntityManager;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.PersistenceContext;
+import javax.persistence.TypedQuery;
+import java.util.Properties;
+
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(ApplicationComposer.class)
+public class JTAPuAndBmtTest {
+    @EJB
+    private BmtManager bmtManager;
+
+    @Configuration
+    public Properties config() {
+        final Properties p = new Properties();
+        p.put("JTAPuAndBmtTest", "new://Resource?type=DataSource");
+        p.put("JTAPuAndBmtTest.JdbcDriver", "org.hsqldb.jdbcDriver");
+        p.put("JTAPuAndBmtTest.JdbcUrl", "jdbc:hsqldb:mem:bval");
+        return p;
+    }
+
+    @Module
+    public StatelessBean app() throws Exception {
+        final StatelessBean bean = new StatelessBean(BmtManager.class);
+        bean.setLocalBean(new Empty());
+        return bean;
+    }
+
+    @Module
+    public Persistence persistence() {
+        final PersistenceUnit unit = new PersistenceUnit("foo-unit");
+        unit.addClass(TheEntity.class);
+        unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+        unit.getProperties().setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
+        unit.setExcludeUnlistedClasses(true);
+
+        final Persistence persistence = new Persistence(unit);
+        persistence.setVersion("2.0");
+        return persistence;
+    }
+
+    @LocalBean
+    @Stateless
+    @TransactionManagement(TransactionManagementType.BEAN)
+    public static class BmtManager {
+        @PersistenceContext
+        private EntityManager em;
+
+        @Resource
+        private EJBContext ctx;
+
+        public TheEntity persist() {
+            try {
+                ctx.getUserTransaction().begin();
+                final TheEntity entity = new TheEntity();
+                entity.setName("name");
+                em.persist(entity);
+                ctx.getUserTransaction().commit();
+                return entity;
+            } catch (final Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        public TheEntity findWithJpQl() {
+            final TypedQuery<TheEntity> query = em.createQuery("select e from JTAPuAndBmtTest$TheEntity e", TheEntity.class);
+            query.getResultList(); // to ensure we don't break OPENEJB-1443
+            return query.getResultList().iterator().next();
+        }
+
+        public void update(final TheEntity entity) {
+            entity.setName("new");
+            try {
+                ctx.getUserTransaction().begin();
+                em.merge(entity);
+                ctx.getUserTransaction().commit();
+            } catch (final Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    @Entity
+    public static class TheEntity {
+        @Id
+        @GeneratedValue
+        private long id;
+        private String name;
+
+        public long getId() {
+            return id;
+        }
+
+        public void setId(final long i) {
+            id = i;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(final String n) {
+            name = n;
+        }
+    }
+
+    @Test
+    public void valid() {
+        assertNotNull(bmtManager.persist());
+
+        final TheEntity entity = bmtManager.findWithJpQl();
+        assertNotNull(entity);
+
+        bmtManager.update(entity); // will throw an exception if any error
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/junit/PreDestroyTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/junit/PreDestroyTest.java b/container/openejb-core/src/test/java/org/apache/openejb/junit/PreDestroyTest.java
index 3b66dfb..9f6aea7 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/junit/PreDestroyTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/junit/PreDestroyTest.java
@@ -1,82 +1,82 @@
-/**
- * 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.
- */
-package org.apache.openejb.junit;
-
-import org.apache.openejb.jee.SessionBean;
-import org.apache.openejb.jee.SingletonBean;
-import org.junit.AfterClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import javax.ejb.Singleton;
-import javax.inject.Inject;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Test for https://issues.apache.org/jira/browse/OPENEJB-2014
- *
- * @version $Rev$ $Date$
- */
-@RunWith(ApplicationComposer.class)
-public class PreDestroyTest {
-
-    private static final AtomicBoolean isConstructed = new AtomicBoolean(false);
-    private static final AtomicBoolean isDestroyed = new AtomicBoolean(false);
-
-    @Inject
-    private TestMe testMe;
-
-    @AfterClass
-    public static void onAfterClass() {
-        assertTrue("onPostConstruct was not called", isConstructed.get());
-        assertTrue("onPreDestroy was not called", isDestroyed.get());
-    }
-
-    @org.apache.openejb.testing.Module
-    public SessionBean getEjbs() {
-        return new SingletonBean(TestMe.class);
-    }
-
-    @Test
-    public void testLifecycle() {
-        this.testMe.noOp();
-    }
-
-    @Singleton
-    public static class TestMe {
-
-        @PostConstruct
-        public void onPostConstruct() {
-            isConstructed.set(true);
-        }
-
-        @PreDestroy
-        public void onPreDestroy() {
-            isDestroyed.set(true);
-        }
-
-        public void noOp() {
-            //no-op
-        }
-
-    }
-
-}
+/**
+ * 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.
+ */
+package org.apache.openejb.junit;
+
+import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.SingletonBean;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
+import javax.ejb.Singleton;
+import javax.inject.Inject;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Test for https://issues.apache.org/jira/browse/OPENEJB-2014
+ *
+ * @version $Rev$ $Date$
+ */
+@RunWith(ApplicationComposer.class)
+public class PreDestroyTest {
+
+    private static final AtomicBoolean isConstructed = new AtomicBoolean(false);
+    private static final AtomicBoolean isDestroyed = new AtomicBoolean(false);
+
+    @Inject
+    private TestMe testMe;
+
+    @AfterClass
+    public static void onAfterClass() {
+        assertTrue("onPostConstruct was not called", isConstructed.get());
+        assertTrue("onPreDestroy was not called", isDestroyed.get());
+    }
+
+    @org.apache.openejb.testing.Module
+    public SessionBean getEjbs() {
+        return new SingletonBean(TestMe.class);
+    }
+
+    @Test
+    public void testLifecycle() {
+        this.testMe.noOp();
+    }
+
+    @Singleton
+    public static class TestMe {
+
+        @PostConstruct
+        public void onPostConstruct() {
+            isConstructed.set(true);
+        }
+
+        @PreDestroy
+        public void onPreDestroy() {
+            isDestroyed.set(true);
+        }
+
+        public void noOp() {
+            //no-op
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6e2a4f7c/container/openejb-core/src/test/java/org/apache/openejb/resource/URLAsResourceTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/URLAsResourceTest.java b/container/openejb-core/src/test/java/org/apache/openejb/resource/URLAsResourceTest.java
index dda0eed..d63518d 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/resource/URLAsResourceTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/URLAsResourceTest.java
@@ -1,71 +1,71 @@
-/*
- * 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.
- */
-package org.apache.openejb.resource;
-
-import org.apache.openejb.jee.EnterpriseBean;
-import org.apache.openejb.jee.SingletonBean;
-import org.apache.openejb.junit.ApplicationComposer;
-import org.apache.openejb.testing.Configuration;
-import org.apache.openejb.testing.Module;
-import org.apache.openejb.testng.PropertiesBuilder;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.annotation.Resource;
-import javax.ejb.EJB;
-import javax.ejb.Singleton;
-import java.net.URL;
-import java.util.Properties;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-@RunWith(ApplicationComposer.class)
-public class URLAsResourceTest {
-    @Configuration
-    public Properties config() {
-        return new PropertiesBuilder()
-            .p("url", "new://Resource?class-name=java.net.URL&constructor=value")
-            .p("url.value", "http://tomee.apache.org")
-            .build();
-    }
-
-    @Module
-    public EnterpriseBean bean() {
-        return new SingletonBean(WithUrl.class).localBean();
-    }
-
-    @EJB
-    private WithUrl withUrl;
-
-    @Test
-    public void url() {
-        final URL url = withUrl.getUrl();
-        assertNotNull(url);
-        assertEquals("http://tomee.apache.org", url.toExternalForm());
-    }
-
-    @Singleton
-    public static class WithUrl {
-        @Resource(name = "url")
-        private URL url;
-
-        public URL getUrl() {
-            return url;
-        }
-    }
-}
+/*
+ * 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.
+ */
+package org.apache.openejb.resource;
+
+import org.apache.openejb.jee.EnterpriseBean;
+import org.apache.openejb.jee.SingletonBean;
+import org.apache.openejb.junit.ApplicationComposer;
+import org.apache.openejb.testing.Configuration;
+import org.apache.openejb.testing.Module;
+import org.apache.openejb.testng.PropertiesBuilder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.ejb.EJB;
+import javax.ejb.Singleton;
+import java.net.URL;
+import java.util.Properties;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+@RunWith(ApplicationComposer.class)
+public class URLAsResourceTest {
+    @Configuration
+    public Properties config() {
+        return new PropertiesBuilder()
+            .p("url", "new://Resource?class-name=java.net.URL&constructor=value")
+            .p("url.value", "http://tomee.apache.org")
+            .build();
+    }
+
+    @Module
+    public EnterpriseBean bean() {
+        return new SingletonBean(WithUrl.class).localBean();
+    }
+
+    @EJB
+    private WithUrl withUrl;
+
+    @Test
+    public void url() {
+        final URL url = withUrl.getUrl();
+        assertNotNull(url);
+        assertEquals("http://tomee.apache.org", url.toExternalForm());
+    }
+
+    @Singleton
+    public static class WithUrl {
+        @Resource(name = "url")
+        private URL url;
+
+        public URL getUrl() {
+            return url;
+        }
+    }
+}