Hi Romain,

PersistJavaagentTest fails at the last assertion for me. Missing commit?

[]s,
Thiago.

On Mon, Oct 20, 2014 at 10:37 AM, <[email protected]> wrote:

> Repository: tomee
> Updated Branches:
>   refs/heads/tomee-1.7.x 0419ed7a9 -> dbb8577b2
>
>
> missing tests
>
>
> Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
> Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/dbb8577b
> Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/dbb8577b
> Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/dbb8577b
>
> Branch: refs/heads/tomee-1.7.x
> Commit: dbb8577b24d6f008ed9791ecf9888b29a4c1626d
> Parents: 0419ed7
> Author: Romain Manni-Bucau <[email protected]>
> Authored: Mon Oct 20 16:37:22 2014 +0200
> Committer: Romain Manni-Bucau <[email protected]>
> Committed: Mon Oct 20 16:37:22 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/dbb8577b/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/dbb8577b/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"));
> +    }
> +}
>
>

Reply via email to