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 2014/10/20 16:37:14 UTC

git commit: missing tests

Repository: tomee
Updated Branches:
  refs/heads/develop 4e59a1226 -> a8dc44661


missing tests


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

Branch: refs/heads/develop
Commit: a8dc446615025a774a3ee5cafc5da0823b3ecb0d
Parents: 4e59a12
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon Oct 20 16:37:07 2014 +0200
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon Oct 20 16:37:07 2014 +0200

----------------------------------------------------------------------
 .../maven/plugin/test/CustomizerTest.java       | 65 ++++++++++++++++++++
 .../maven/plugin/test/PersistJavaagentTest.java | 62 +++++++++++++++++++
 2 files changed, 127 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/a8dc4466/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/CustomizerTest.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/CustomizerTest.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/CustomizerTest.java
new file mode 100644
index 0000000..6d8333a
--- /dev/null
+++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/CustomizerTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.maven.plugin.test;
+
+import org.apache.openejb.maven.plugin.Config;
+import org.apache.openejb.maven.plugin.TomEEMavenPluginRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class CustomizerTest {
+    @Rule
+    public TomEEMavenPluginRule TMPRule = new TomEEMavenPluginRule();
+
+    @Config
+    private final List<String> customizers = asList(MyCustomizer.class.getName(), MyCustomizer2.class.getName());
+
+    @Test
+    public void wasExecutedAndCorrectlyInitialized() throws Exception {
+        assertNotNull(MyCustomizer.BASE);
+        assertTrue(MyCustomizer2.DONE);
+    }
+
+    public static class MyCustomizer implements Runnable {
+        private static File BASE;
+        private final File base;
+
+        public MyCustomizer(final File base) {
+            this.base = base;
+        }
+
+        @Override
+        public void run() {
+            BASE = base;
+        }
+    }
+    public static class MyCustomizer2 implements Runnable {
+        private static boolean DONE;
+
+        @Override
+        public void run() {
+            DONE = true;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/a8dc4466/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/PersistJavaagentTest.java
----------------------------------------------------------------------
diff --git a/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/PersistJavaagentTest.java b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/PersistJavaagentTest.java
new file mode 100644
index 0000000..7bc36df
--- /dev/null
+++ b/maven/tomee-maven-plugin/src/test/java/org/apache/openejb/maven/plugin/test/PersistJavaagentTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.maven.plugin.test;
+
+import org.apache.openejb.loader.IO;
+import org.apache.openejb.maven.plugin.Config;
+import org.apache.openejb.maven.plugin.TomEEMavenPluginRule;
+import org.junit.Rule;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.List;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class PersistJavaagentTest {
+    @Rule
+    public TomEEMavenPluginRule TMPRule = new TomEEMavenPluginRule();
+
+    @Config
+    private final List<String> javaagents = asList("org.apache.sirona:sirona-javaagent:0.2-incubating:jar:shaded");
+
+    @Config
+    private final boolean persistJavaagents = true;
+    @Config
+    private final File catalinaBase = new File("target/tomee-agent");
+
+    @Test
+    public void sironaIsInstalledAndPersisted() throws Exception {
+        assertTrue(catalinaBase.exists());
+
+        // artifact was copied
+        assertEquals(1, new File(catalinaBase, "javaagent").listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                return name.startsWith("sirona-") && name.endsWith("-shaded.jar");
+            }
+        }).length);
+
+        // catalina.sh was updated
+        final String catalinaSh = IO.slurp(new File(catalinaBase, "bin/catalina.sh"));
+        assertTrue(catalinaSh.contains("-javaagent:$CATALINA_HOME/javaagent/sirona-javaagent"));
+    }
+}