You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by st...@apache.org on 2021/12/13 10:48:58 UTC

[openwebbeans-meecrowave] branch master updated (4a510fb -> 6e13cc7)

This is an automated email from the ASF dual-hosted git repository.

struberg pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans-meecrowave.git.


    from 4a510fb  MEECROWAVE-304 upgrade to log4j 2.15.0
     new d72fe05  improve failure handling when startup doesn't work
     new 6e13cc7  MEECROWAVE-305 update some dependencies

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/meecrowave/MeecrowaveTest.java | 18 +++----
 meecrowave-jpa/pom.xml                             |  2 +-
 .../meecrowave/maven/MeecrowaveRunMojoTest.java    | 61 +++++++++++++---------
 meecrowave-oauth2-minimal/pom.xml                  |  2 +-
 meecrowave-oauth2/pom.xml                          |  2 +-
 pom.xml                                            | 10 ++--
 6 files changed, 54 insertions(+), 41 deletions(-)

[openwebbeans-meecrowave] 01/02: improve failure handling when startup doesn't work

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans-meecrowave.git

commit d72fe05d2a2ce1c0964e2a643463cfbd721522ba
Author: Mark Struberg <st...@apache.org>
AuthorDate: Sun Dec 12 23:31:45 2021 +0100

    improve failure handling when startup doesn't work
---
 .../meecrowave/maven/MeecrowaveRunMojoTest.java    | 61 +++++++++++++---------
 1 file changed, 37 insertions(+), 24 deletions(-)

diff --git a/meecrowave-maven-plugin/src/test/java/org/apache/meecrowave/maven/MeecrowaveRunMojoTest.java b/meecrowave-maven-plugin/src/test/java/org/apache/meecrowave/maven/MeecrowaveRunMojoTest.java
index f487538..fb79211 100644
--- a/meecrowave-maven-plugin/src/test/java/org/apache/meecrowave/maven/MeecrowaveRunMojoTest.java
+++ b/meecrowave-maven-plugin/src/test/java/org/apache/meecrowave/maven/MeecrowaveRunMojoTest.java
@@ -38,6 +38,8 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.StandardCharsets;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Stream;
@@ -124,19 +126,20 @@ public class MeecrowaveRunMojoTest {
     public void classpathDeployment() throws Exception {
         execution.getConfiguration().getChild("httpPort").setValue(Integer.toString(port));
         final Runnable quitCommand = quitCommand();
-        final Thread mojoExecutor = mojoExecutor();
+        List<Exception> mojoFailure = new CopyOnWriteArrayList<>();
+        final Thread mojoExecutor = mojoExecutor(mojoFailure);
         try {
             mojoExecutor.start();
             retry(() -> {
-            	assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + port + "/api/test")));
-            	assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("first_name"));
-            	assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("last_name"));
-            	assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("firstname"));
-            	assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("null"));
-            	assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/sub/index.html")).contains("<h1>yes</h1>"));
-            	assertNotAvailable(new URL("http://localhost:" + port + "/api/additional"));
-            	quitCommand.run();
-            });
+                assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + port + "/api/test")));
+                assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("first_name"));
+                assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("last_name"));
+                assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("firstname"));
+                assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/test/model")).contains("null"));
+                assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/sub/index.html")).contains("<h1>yes</h1>"));
+                assertNotAvailable(new URL("http://localhost:" + port + "/api/additional"));
+                quitCommand.run();
+            }, mojoFailure);
         } finally {
             mojoExecutor.join(TimeUnit.MINUTES.toMillis(1));
             if (mojoExecutor.isAlive()) {
@@ -157,7 +160,8 @@ public class MeecrowaveRunMojoTest {
         execution.getConfiguration().getChild("useClasspathDeployment").setValue("false");
         execution.getConfiguration().getChild("webapp").setValue(webappDirectory.getAbsolutePath());
         final Runnable quitCommand = quitCommand();
-        final Thread mojoExecutor = mojoExecutor();
+        List<Exception> mojoFailure = new CopyOnWriteArrayList<>();
+        final Thread mojoExecutor = mojoExecutor(mojoFailure);
         try {
             mojoExecutor.start();
             retry(() -> {
@@ -169,7 +173,7 @@ public class MeecrowaveRunMojoTest {
                 assertTrue(IOUtils.toString(new URL("http://localhost:" + port + "/api/additional")).contains("available"));
                 assertNotAvailable(new URL("http://localhost:" + port + "/sub/index.html"));
                 quitCommand.run();
-            });
+            }, mojoFailure);
         } finally {
             mojoExecutor.join(TimeUnit.MINUTES.toMillis(1));
             if (mojoExecutor.isAlive()) {
@@ -185,19 +189,20 @@ public class MeecrowaveRunMojoTest {
         execution.getConfiguration().getChild("httpPort").setValue(Integer.toString(port));
         execution.getConfiguration().getChild("watcherBouncing").setValue("1");
         Runnable quitCommand = quitCommand();
-        final Thread mojoExecutor = mojoExecutor();
+        List<Exception> mojoFailure = new CopyOnWriteArrayList<>();
+        final Thread mojoExecutor = mojoExecutor(mojoFailure);
         try {
             mojoExecutor.start();
             retry(() -> {
                 assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + port + "/api/test")));
                 assertNotAvailable(new URL("http://localhost:" + port + "/api/additional"));
-            });
+            }, mojoFailure);
             File folder = additionalEndpointFile.getParentFile();
             folder.mkdirs();
             assertTrue(folder.exists());
             IOUtils.write(additionalEndpointClass, new FileOutputStream(additionalEndpointFile));
-            retry(() -> assertEquals("available", IOUtils.toString(new URL("http://localhost:" + port + "/api/additional"))));
-			retry(() -> assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + port + "/api/test"))));
+            retry(() -> assertEquals("available", IOUtils.toString(new URL("http://localhost:" + port + "/api/additional"))), mojoFailure);
+            retry(() -> assertEquals("simple", IOUtils.toString(new URL("http://localhost:" + port + "/api/test"))), mojoFailure);
             quitCommand.run();
         } finally {
             additionalEndpointFile.delete();
@@ -240,23 +245,27 @@ public class MeecrowaveRunMojoTest {
                     fail(e.getMessage());
                 }
                 if (delegate.available() > 0) {
-                	return delegate.read();
+                    return delegate.read();
                 } else {
-                	System.setIn(in);
-                	return -1;
+                    System.setIn(in);
+                    return -1;
                 }
             }
         });
-    	return latch::countDown;
+        return latch::countDown;
     }
 
-    private Thread mojoExecutor() {
+    private Thread mojoExecutor(List<Exception> mojoFailure) {
         return new Thread() {
             @Override
             public void run() {
                 try {
                     mojo.executeMojo(session, project, execution);
                 } catch (final Exception e) {
+                    if (mojoFailure != null) {
+                        mojoFailure.add(e);
+                    }
+
                     fail(e.getMessage());
                 }
             }
@@ -274,9 +283,9 @@ public class MeecrowaveRunMojoTest {
         }
     }
 
-    private void retry(RetryTemplate retryTemplate) throws InterruptedException {
+    private void retry(RetryTemplate retryTemplate, List<Exception> mojoFailure) throws InterruptedException {
         Throwable error = null;
-        for (int i = 0; i < RETRY_COUNT; i++) {
+        for (int i = 0; i < RETRY_COUNT && mojoFailure.isEmpty(); i++) {
             try {
                 retryTemplate.retry();
                 return;
@@ -285,10 +294,14 @@ public class MeecrowaveRunMojoTest {
                 Thread.sleep(RETRY_WAIT_PERIOD);
             }
         }
+        if (!mojoFailure.isEmpty()) {
+            mojoFailure.get(0).printStackTrace();
+            fail("Error while starting Meecrowave");
+        }
         fail(ofNullable(error).map(Throwable::getMessage).orElse("retry failes"));
     }
 
     interface RetryTemplate {
-    	void retry() throws Exception;
+        void retry() throws Exception;
     }
 }

[openwebbeans-meecrowave] 02/02: MEECROWAVE-305 update some dependencies

Posted by st...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

struberg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwebbeans-meecrowave.git

commit 6e13cc709f558cd747b4f7a7ceef43dd157cec0d
Author: Mark Struberg <st...@apache.org>
AuthorDate: Mon Dec 13 11:36:27 2021 +0100

    MEECROWAVE-305 update some dependencies
    
    * tomcat 9.0.54 -> 9.0.56
    * OpenWebBeans 2.0.23 -> 2.0.25
    * DeltaSpike 1.8.2 -> 1.9.5
    * JPA to 2.2 spec
---
 .../java/org/apache/meecrowave/MeecrowaveTest.java     | 18 +++++++++---------
 meecrowave-jpa/pom.xml                                 |  2 +-
 meecrowave-oauth2-minimal/pom.xml                      |  2 +-
 meecrowave-oauth2/pom.xml                              |  2 +-
 pom.xml                                                | 10 +++++-----
 5 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/meecrowave-core/src/test/java/org/apache/meecrowave/MeecrowaveTest.java b/meecrowave-core/src/test/java/org/apache/meecrowave/MeecrowaveTest.java
index e5a2caa..0e17504 100644
--- a/meecrowave-core/src/test/java/org/apache/meecrowave/MeecrowaveTest.java
+++ b/meecrowave-core/src/test/java/org/apache/meecrowave/MeecrowaveTest.java
@@ -172,7 +172,7 @@ public class MeecrowaveTest {
             assertEquals("simple", slurp(new URL("http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/api/other")));
             assertEquals("simplefiltertrue", slurp(new URL("http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/filter")));
             assertEquals("filtertrue", slurp(new URL("http://localhost:" + meecrowave.getConfiguration().getHttpPort() + "/other")));
-        } catch (final IOException e) {
+        } catch (final Exception e) {
             fail(e.getMessage());
         }
     }
@@ -220,14 +220,14 @@ public class MeecrowaveTest {
     }
 
     private void assertNotAvailable(final URL url) {
-    	try {
-    		URLConnection connection = url.openConnection();
-    		connection.setReadTimeout(500);
-			connection.getInputStream();
-			fail(url.toString() + " is available");
-		} catch (Exception e) {
-			assertTrue(e.getMessage(), e instanceof IOException);
-		}
+        try {
+            URLConnection connection = url.openConnection();
+            connection.setReadTimeout(500);
+            connection.getInputStream();
+            fail(url.toString() + " is available");
+        } catch (Exception e) {
+            assertTrue(e.getMessage(), e instanceof IOException);
+        }
     }
 
     private String slurp(final URL url) {
diff --git a/meecrowave-jpa/pom.xml b/meecrowave-jpa/pom.xml
index b85338e..cedcda7 100644
--- a/meecrowave-jpa/pom.xml
+++ b/meecrowave-jpa/pom.xml
@@ -35,7 +35,7 @@
   <dependencies>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-jpa_2.1_spec</artifactId>
+      <artifactId>geronimo-jpa_2.2_spec</artifactId>
       <version>${jpa-spec.version}</version>
     </dependency>
     <dependency>
diff --git a/meecrowave-oauth2-minimal/pom.xml b/meecrowave-oauth2-minimal/pom.xml
index 5d87910..37eb994 100644
--- a/meecrowave-oauth2-minimal/pom.xml
+++ b/meecrowave-oauth2-minimal/pom.xml
@@ -111,7 +111,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-jpa_2.1_spec</artifactId>
+      <artifactId>geronimo-jpa_2.2_spec</artifactId>
       <version>${jpa-spec.version}</version>
       <scope>provided</scope>
     </dependency>
diff --git a/meecrowave-oauth2/pom.xml b/meecrowave-oauth2/pom.xml
index af40579..b6756e5 100644
--- a/meecrowave-oauth2/pom.xml
+++ b/meecrowave-oauth2/pom.xml
@@ -68,7 +68,7 @@
     </dependency>
     <dependency>
       <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-jpa_2.1_spec</artifactId>
+      <artifactId>geronimo-jpa_2.2_spec</artifactId>
       <version>${jpa-spec.version}</version>
     </dependency>
     <dependency>
diff --git a/pom.xml b/pom.xml
index ff2abe2..693ef3b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -50,16 +50,16 @@
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <meecrowave.build.name>${project.groupId}.${project.artifactId}</meecrowave.build.name>
 
-    <junit.version>4.13.1</junit.version>
-    <tomcat.version>9.0.54</tomcat.version>
-    <openwebbeans.version>2.0.23</openwebbeans.version>
+    <junit.version>4.13.2</junit.version>
+    <tomcat.version>9.0.56</tomcat.version>
+    <openwebbeans.version>2.0.25-SNAPSHOT</openwebbeans.version>
     <cxf.version>3.4.5</cxf.version>
     <johnzon.version>1.2.14</johnzon.version>
     <log4j2.version>2.15.0</log4j2.version>
-    <deltaspike.version>1.8.2</deltaspike.version>
+    <deltaspike.version>1.9.5</deltaspike.version>
     <jaxb.version>2.2.11</jaxb.version>
     <openjpa.version>3.2.0</openjpa.version>
-    <jpa-spec.version>1.0-alpha-1</jpa-spec.version>
+    <jpa-spec.version>1.1</jpa-spec.version>
     <h2.version>1.4.200</h2.version>
     <dbcp2.version>2.8.0</dbcp2.version>
     <commons-cli.version>1.4</commons-cli.version>