You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2016/06/06 05:50:13 UTC

tomee git commit: TOMEE-1828 ensure offline mode supports system app

Repository: tomee
Updated Branches:
  refs/heads/master 780021e0b -> 34dd01a87


TOMEE-1828 ensure offline mode supports system app


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/34dd01a8
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/34dd01a8
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/34dd01a8

Branch: refs/heads/master
Commit: 34dd01a8765dd8a9fc3afe4cf49e7f687568dd66
Parents: 780021e
Author: Romain manni-Bucau <rm...@gmail.com>
Authored: Mon Jun 6 07:49:50 2016 +0200
Committer: Romain manni-Bucau <rm...@gmail.com>
Committed: Mon Jun 6 07:49:50 2016 +0200

----------------------------------------------------------------------
 .../apache/openejb/config/SystemAppInfo.java    |  2 +-
 .../openejb/config/SystemAppInfoTest.java       | 47 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/34dd01a8/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java b/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java
index a33eda0..28ad617 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/SystemAppInfo.java
@@ -126,7 +126,7 @@ public final class SystemAppInfo {
     // simplified logic compared to AutoConfig
     private static String findSingletonContainer(final ConfigurationFactory configFactory) throws OpenEJBException {
         for (final ContainerInfo containerInfo : configFactory.getContainerInfos()) {
-            if (SingletonSessionContainerInfo.class.isInstance(configFactory)) {
+            if (SingletonSessionContainerInfo.class.isInstance(containerInfo)) {
                 return containerInfo.id;
             }
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/34dd01a8/container/openejb-core/src/test/java/org/apache/openejb/config/SystemAppInfoTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/config/SystemAppInfoTest.java b/container/openejb-core/src/test/java/org/apache/openejb/config/SystemAppInfoTest.java
new file mode 100644
index 0000000..69dc65d
--- /dev/null
+++ b/container/openejb-core/src/test/java/org/apache/openejb/config/SystemAppInfoTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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;
+
+import org.apache.openejb.assembler.classic.ContainerInfo;
+import org.apache.openejb.assembler.classic.SingletonSessionContainerInfo;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.fail;
+
+public class SystemAppInfoTest {
+    @Test
+    public void run() {
+        try {
+            SystemAppInfo.preComputedInfo(new ConfigurationFactory() {
+                @Override
+                protected List<ContainerInfo> getContainerInfos() {
+                    return Collections.<ContainerInfo>singletonList(new SingletonSessionContainerInfo());
+                }
+
+                @Override
+                public boolean isOffline() {
+                    return true;
+                }
+            });
+        } catch (final IllegalStateException ise) {
+            fail(ise.getMessage());
+        }
+    }
+}