tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: missing files
Date Sun, 22 Feb 2015 21:13:38 GMT
Repository: tomee
Updated Branches:
  refs/heads/develop 7ab0188cd -> 6fb3304aa


missing files


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

Branch: refs/heads/develop
Commit: 6fb3304aa6780aebc21355a62fd6dad432b89826
Parents: 7ab0188
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Sun Feb 22 22:13:33 2015 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Sun Feb 22 22:13:33 2015 +0100

----------------------------------------------------------------------
 .../apache/openejb/junit/ApplicationRule.java   | 68 ++++++++++++++++++++
 .../org/apache/openejb/junit/ContainerRule.java | 63 ++++++++++++++++++
 2 files changed, 131 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/6fb3304a/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationRule.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationRule.java
b/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationRule.java
new file mode 100644
index 0000000..3f9acd8
--- /dev/null
+++ b/container/openejb-core/src/main/java/org/apache/openejb/junit/ApplicationRule.java
@@ -0,0 +1,68 @@
+/*
+ * 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.testing.ApplicationComposers;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.util.Objects;
+
+public class ApplicationRule implements TestRule {
+    private final Object instance;
+
+    public ApplicationRule(final Object instance) {
+        this.instance = Objects.requireNonNull(instance);
+    }
+
+    public <T> T getInstance(final Class<T> as) {
+        return as.cast(instance);
+    }
+
+    @Override
+    public Statement apply(final Statement statement, final Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                final ApplicationComposers composers = new ApplicationOnlyApplicationComposers(instance);
+                composers.deployApp(instance);
+                try {
+                    statement.evaluate();
+                } finally {
+                    composers.stopApplication();
+                }
+            }
+        };
+    }
+
+    public static class ApplicationOnlyApplicationComposers extends ApplicationComposers
{
+        public ApplicationOnlyApplicationComposers(final Object modules) {
+            super(modules);
+        }
+
+        @Override
+        protected boolean isContainer() {
+            return false;
+        }
+
+        @Override
+        protected boolean mockCdiContexts() {
+            return false;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/6fb3304a/container/openejb-core/src/main/java/org/apache/openejb/junit/ContainerRule.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/junit/ContainerRule.java
b/container/openejb-core/src/main/java/org/apache/openejb/junit/ContainerRule.java
new file mode 100644
index 0000000..56224f9
--- /dev/null
+++ b/container/openejb-core/src/main/java/org/apache/openejb/junit/ContainerRule.java
@@ -0,0 +1,63 @@
+/*
+ * 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.testing.ApplicationComposers;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.util.Objects;
+
+public class ContainerRule implements TestRule {
+    private final Object instance;
+
+    public ContainerRule(final Object instance) {
+        this.instance = Objects.requireNonNull(instance);
+    }
+
+    public <T> T getInstance(final Class<T> as) {
+        return as.cast(instance);
+    }
+
+    @Override
+    public Statement apply(final Statement statement, final Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                final ApplicationComposers composers = new ContainerApplicationComposers(instance);
+                composers.startContainer(instance);
+                try {
+                    statement.evaluate();
+                } finally {
+                    composers.after();
+                }
+            }
+        };
+    }
+
+    public static class ContainerApplicationComposers extends ApplicationComposers {
+        public ContainerApplicationComposers(final Object modules) {
+            super(modules);
+        }
+
+        @Override
+        protected boolean isApplication() {
+            return false;
+        }
+    }
+}


Mime
View raw message