[jira] [Created] (TOMEE-1848) add @Configuration support for TomEEEmbeddedSingleRunner

2016-06-21 Thread Romain Manni-Bucau (JIRA)
Romain Manni-Bucau created TOMEE-1848:
-

 Summary: add @Configuration support for TomEEEmbeddedSingleRunner
 Key: TOMEE-1848
 URL: https://issues.apache.org/jira/browse/TOMEE-1848
 Project: TomEE
  Issue Type: New Feature
Reporter: Romain Manni-Bucau
Assignee: Romain Manni-Bucau
 Fix For: 7.0.1






--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (TOMEE-1848) add @Configuration support for TomEEEmbeddedSingleRunner

2016-06-21 Thread Romain Manni-Bucau (JIRA)

 [ 
https://issues.apache.org/jira/browse/TOMEE-1848?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Romain Manni-Bucau resolved TOMEE-1848.
---
Resolution: Fixed

> add @Configuration support for TomEEEmbeddedSingleRunner
> 
>
> Key: TOMEE-1848
> URL: https://issues.apache.org/jira/browse/TOMEE-1848
> Project: TomEE
>  Issue Type: New Feature
>Reporter: Romain Manni-Bucau
>Assignee: Romain Manni-Bucau
> Fix For: 7.0.1
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


tomee git commit: TOMEE-1848 @Configuration support for TomEEEmbeddedSingleRunner

2016-06-21 Thread rmannibucau
Repository: tomee
Updated Branches:
  refs/heads/master 111989beb -> 30e42e463


TOMEE-1848 @Configuration support for TomEEEmbeddedSingleRunner


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

Branch: refs/heads/master
Commit: 30e42e46313fbb3f952114ce0f4ad65ca92e6694
Parents: 111989b
Author: Romain manni-Bucau 
Authored: Wed Jun 22 07:33:30 2016 +0200
Committer: Romain manni-Bucau 
Committed: Wed Jun 22 07:33:30 2016 +0200

--
 .../junit/TomEEEmbeddedSingleRunner.java| 25 
 .../embedded/SingleInstanceRunnerTest.java  |  8 +++
 2 files changed, 33 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/tomee/blob/30e42e46/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedSingleRunner.java
--
diff --git 
a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedSingleRunner.java
 
b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedSingleRunner.java
index 4635e2f..b223663 100644
--- 
a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedSingleRunner.java
+++ 
b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/junit/TomEEEmbeddedSingleRunner.java
@@ -16,6 +16,7 @@
  */
 package org.apache.tomee.embedded.junit;
 
+import org.apache.openejb.config.sys.Openejb;
 import org.apache.openejb.testing.Application;
 import org.apache.openejb.testing.Classes;
 import org.apache.openejb.testing.ContainerProperties;
@@ -26,6 +27,7 @@ import org.apache.tomee.embedded.Container;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.inject.OWBInjector;
 import org.apache.xbean.finder.AnnotationFinder;
+import org.apache.xbean.finder.archive.ClassesArchive;
 import org.apache.xbean.finder.archive.FileArchive;
 import org.junit.rules.MethodRule;
 import org.junit.rules.TestRule;
@@ -43,6 +45,7 @@ import java.io.IOException;
 import java.lang.annotation.Retention;
 import java.lang.annotation.Target;
 import java.lang.reflect.Field;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -50,11 +53,13 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.concurrent.atomic.AtomicReference;
 
 import static java.lang.annotation.ElementType.TYPE;
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 import static org.apache.openejb.loader.JarLocation.jarLocation;
+import static org.apache.openejb.util.Classes.ancestors;
 
 /**
  * see org.apache.tomee.embedded.SingleInstanceRunnerTest for a sample.
@@ -65,6 +70,7 @@ import static 
org.apache.openejb.loader.JarLocation.jarLocation;
  * Note: @Application classes are only searched in the same jar as the test.
  *
  * Model:
+ * - @Configuration: programmatic properties - note injections don't work 
there.
  * - @Classes: only context value is used.
  * - @ContainerProperties: to configure the container
  * - @WebResource: first value can be used to set the docBase (other values 
are ignored)
@@ -181,6 +187,7 @@ public class TomEEEmbeddedSingleRunner extends 
BlockJUnit4ClassRunner {
 started = true;
 
 final Class appClass = APP.get().getClass();
+final AnnotationFinder finder = new AnnotationFinder(new 
ClassesArchive(ancestors(appClass)));
 
 // setup the container config reading class annotation, using 
a randome http port and deploying the classpath
 final Configuration configuration = new Configuration();
@@ -191,6 +198,24 @@ public class TomEEEmbeddedSingleRunner extends 
BlockJUnit4ClassRunner {
 }
 }
 
+Openejb openejb = null;
+final List annotatedMethods = 
finder.findAnnotatedMethods(org.apache.openejb.testing.Configuration.class);
+if (annotatedMethods.size() > 1) {
+throw new IllegalArgumentException("Only one 
@Configuration is supported: " + annotatedMethods);
+}
+for (final Method m : annotatedMethods) {
+final Object o = m.invoke(APP.get());
+if (Properties.class.isInstance(o)) {
+final Properties properties = Properties.class.cast(o);
+if (configuration.getProperties() == null) {
+configuration.setProperties(new Properties());
+}
+conf

buildbot failure in on tomee-trunk-ubuntu-jvm8

2016-06-21 Thread buildbot
The Buildbot has detected a new failure on builder tomee-trunk-ubuntu-jvm8 
while building tomee. Full details are available at:
https://ci.apache.org/builders/tomee-trunk-ubuntu-jvm8/builds/359

Buildbot URL: https://ci.apache.org/

Buildslave for this Build: hemera_ubuntu

Build Reason: The SingleBranchScheduler scheduler named 
'on-tomee-trunk-ubuntu-jvm8-commit' triggered this build
Build Source Stamp: [branch master] 111989bebb8f315c7d6ea61118d508767a0e34d8
Blamelist: Romain manni-Bucau 

BUILD FAILED: failed test

Sincerely,
 -The Buildbot





[jira] [Commented] (TOMEE-1842) Stripping version strips not only a version

2016-06-21 Thread Romain Manni-Bucau (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341614#comment-15341614
 ] 

Romain Manni-Bucau commented on TOMEE-1842:
---

Have to admit that finalName was not handled by design. Pushed a small 
enhancement (replacing brutally -version but "" on the final name for the war - 
of course it ignores case where final name will not use - but for such cases we 
are back to the case where the user can override stripVersions). Let me know if 
it is better. If not maybe suggest a patch (in the code we have the artifactId, 
the finalName, the version if it helps).

> Stripping version strips not only a version
> ---
>
> Key: TOMEE-1842
> URL: https://issues.apache.org/jira/browse/TOMEE-1842
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Maven Plugin
>Affects Versions: 7.0.0
>Reporter: Andrzej K
>Assignee: Romain Manni-Bucau
>
> When eaither flag stripWarVersion, or StripVersion is true and artifact names 
> is, for example, bar.foo:abc-def then plugin strips "\-def" as it looks for 
> first occurence of "\-". It should rather look for a regex like 
> \[\-\]\d+(.\d+(.\d+)?)?$



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


tomee git commit: TOMEE-1842 a bit better heuristic for stripVersion for wars

2016-06-21 Thread rmannibucau
Repository: tomee
Updated Branches:
  refs/heads/master 243cc841c -> 111989beb


TOMEE-1842 a bit better heuristic for stripVersion for wars


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

Branch: refs/heads/master
Commit: 111989bebb8f315c7d6ea61118d508767a0e34d8
Parents: 243cc84
Author: Romain manni-Bucau 
Authored: Tue Jun 21 13:36:46 2016 +0200
Committer: Romain manni-Bucau 
Committed: Tue Jun 21 13:36:46 2016 +0200

--
 .../apache/openejb/maven/plugin/AbstractTomEEMojo.java | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/tomee/blob/111989be/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
--
diff --git 
a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
 
b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
index 4a16c2c..f103ddd 100644
--- 
a/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
+++ 
b/maven/tomee-maven-plugin/src/main/java/org/apache/openejb/maven/plugin/AbstractTomEEMojo.java
@@ -303,6 +303,12 @@ public abstract class AbstractTomEEMojo extends 
AbstractAddressMojo {
 @Parameter(defaultValue = 
"${project.build.directory}/${project.build.finalName}", readonly = true)
 protected File workWarFile;
 
+@Parameter(defaultValue = "${project.build.finalName}", readonly = true)
+protected String finalName;
+
+@Parameter(defaultValue = "${project.artifactId}", readonly = true)
+protected String artifactId;
+
 @Parameter(property = "tomee-plugin.remove-default-webapps", defaultValue 
= "true")
 protected boolean removeDefaultWebapps;
 
@@ -761,7 +767,8 @@ public abstract class AbstractTomEEMojo extends 
AbstractAddressMojo {
 try {
 final FileWithMavenMeta file = mvnToFile(lib, defaultType);
 if (extractedName == null && (stripVersion || isWar && 
stripWarVersion)) {
-extractedName = file.stripVersion(!isExplodedWar);
+extractedName = isCurrentArtifact(file) && file.version != 
null ? finalName.replace("-" + file.version, "") :
+file.stripVersion(!isExplodedWar);
 }
 
 if (!unzip) {
@@ -796,6 +803,10 @@ public abstract class AbstractTomEEMojo extends 
AbstractAddressMojo {
 }
 }
 
+private boolean isCurrentArtifact(final FileWithMavenMeta file) {
+return file.artifact.equals(artifactId);
+}
+
 private FileWithMavenMeta mvnToFile(final String lib, final String 
defaultType) throws ArtifactResolutionException, ArtifactNotFoundException {
 final String[] infos = lib.split(":");
 final String classifier;



[jira] [Commented] (TOMEE-1842) Stripping version strips not only a version

2016-06-21 Thread Andrzej K (JIRA)

[ 
https://issues.apache.org/jira/browse/TOMEE-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15341510#comment-15341510
 ] 

Andrzej K commented on TOMEE-1842:
--

Hello!
I've tested it and works great for simple scenarios. In my projects, I 
extensively use . For settings where we want final name 
to be considered, it will not work (artifact name may have nothing to do with 
filename).
I think, your solution is very convenient, but I think it should be mentioned 
that artifact name is taken, not the final name. I think it can be easily 
assumed that if someone uses  he or she needs to pie 
special attention to naming convention.

Thanks for your activity!

> Stripping version strips not only a version
> ---
>
> Key: TOMEE-1842
> URL: https://issues.apache.org/jira/browse/TOMEE-1842
> Project: TomEE
>  Issue Type: Bug
>  Components: TomEE Maven Plugin
>Affects Versions: 7.0.0
>Reporter: Andrzej K
>Assignee: Romain Manni-Bucau
>
> When eaither flag stripWarVersion, or StripVersion is true and artifact names 
> is, for example, bar.foo:abc-def then plugin strips "\-def" as it looks for 
> first occurence of "\-". It should rather look for a regex like 
> \[\-\]\d+(.\d+(.\d+)?)?$



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)