You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by re...@apache.org on 2022/10/30 15:48:24 UTC

[cxf] branch 3.6.x-fixes updated (8dfb8be99b -> dd42fa32d0)

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

reta pushed a change to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git


    from 8dfb8be99b Recording .gitmergeinfo Changes
     new 7dc5dcd398 Added more test for using factory methods as parameter converters (#1004)
     new dd42fa32d0 Recording .gitmergeinfo Changes

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:
 .gitmergeinfo                                      |  1 +
 .../apache/cxf/jaxrs/utils/InjectionUtilsTest.java | 31 ++++++++++++++++++++++
 .../org/apache/cxf/systest/jaxrs/BookStore.java    | 29 ++++++++++++++++++++
 .../cxf/systest/jaxrs/JAXRSLocalTransportTest.java | 24 +++++++++++++++++
 4 files changed, 85 insertions(+)


[cxf] 01/02: Added more test for using factory methods as parameter converters (#1004)

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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 7dc5dcd3988ad31e0ec1dc6bca58963696ef8712
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Oct 30 10:42:49 2022 -0400

    Added more test for using factory methods as parameter converters (#1004)
    
    (cherry picked from commit c378cb2326dde28f0c86e130791f31622b054c89)
---
 .../apache/cxf/jaxrs/utils/InjectionUtilsTest.java | 31 ++++++++++++++++++++++
 .../org/apache/cxf/systest/jaxrs/BookStore.java    | 29 ++++++++++++++++++++
 .../cxf/systest/jaxrs/JAXRSLocalTransportTest.java | 24 +++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
index 8a33325c2d..9b6877cc0b 100644
--- a/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
+++ b/rt/frontend/jaxrs/src/test/java/org/apache/cxf/jaxrs/utils/InjectionUtilsTest.java
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
+import java.util.UUID;
 
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.InternalServerErrorException;
@@ -161,6 +162,14 @@ public class InjectionUtilsTest {
         assertEquals("Type is wrong", CarType.AUDI, carType);
     }
 
+    @Test
+    public void testInstantiateClass() {
+        HelmId helmId = InjectionUtils.handleParameter("a6f7357f-6e7e-40e5-9b4a-c455c23b10a2", false, HelmId.class,
+                                                         HelmId.class, null,
+                                                         ParameterType.QUERY, null);
+        assertEquals("Type is wrong", "a6f7357f-6e7e-40e5-9b4a-c455c23b10a2", helmId.getId());
+    }
+
     @Test
     public void testInstantiateIntegerInQuery() {
         Integer integer = InjectionUtils.handleParameter("", false, Integer.class,
@@ -382,4 +391,26 @@ public class InjectionUtilsTest {
             this.birthDate = birthDate;
         }
     }
+
+    private abstract static class AbstractHelmId {
+        public static HelmId fromString(String id) {
+            return HelmId.of(UUID.fromString(id));
+        }
+    }
+
+    private static final class HelmId extends AbstractHelmId {
+        private final UUID uuid;
+
+        private HelmId(UUID uuid) {
+            this.uuid = uuid;
+        }
+
+        public String getId() {
+            return uuid.toString();
+        }
+
+        public static HelmId of(UUID uuid) {
+            return new HelmId(uuid);
+        }
+    }
 }
\ No newline at end of file
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
index 87bd56a57f..67bd97f8fa 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/BookStore.java
@@ -37,6 +37,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.UUID;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -660,6 +661,13 @@ public class BookStore {
     public boolean checkBook(@PathParam("id") Long id) {
         return books.containsKey(id);
     }
+    
+    @GET
+    @Path("books/check/uuid/{uuid}")
+    @Produces("text/plain,text/boolean")
+    public boolean checkBookUuid(@PathParam("uuid") BookId id) {
+        return books.containsKey(id.getId());
+    }
 
     @GET
     @Path("books/check/malformedmt/{id}")
@@ -2309,6 +2317,27 @@ public class BookStore {
         }
     }
 
+    public abstract static class AbstractBookId {
+        public static BookId fromString(String id) {
+            return BookId.of(UUID.fromString(id));
+        }
+    }
+
+    public static final class BookId extends AbstractBookId {
+        private final UUID uuid;
+
+        private BookId(UUID uuid) {
+            this.uuid = uuid;
+        }
+
+        public long getId() {
+            return uuid.getMostSignificantBits();
+        }
+
+        public static BookId of(UUID uuid) {
+            return new BookId(uuid);
+        }
+    }
 }
 
 
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLocalTransportTest.java b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLocalTransportTest.java
index ba5af20a5e..e36ec49d88 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLocalTransportTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLocalTransportTest.java
@@ -46,8 +46,10 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 public class JAXRSLocalTransportTest extends AbstractBusClientServerTestBase {
@@ -207,6 +209,28 @@ public class JAXRSLocalTransportTest extends AbstractBusClientServerTestBase {
         assertEquals(123L, book.getId());
     }
 
+    
+    @Test
+    public void testWebClientDirectDispatchBookId() throws Exception {
+        WebClient localClient = WebClient.create("local://books");
+        localClient.accept("text/plain");
+
+        WebClient.getConfig(localClient).getRequestContext().put(LocalConduit.DIRECT_DISPATCH, Boolean.TRUE);
+        localClient.path("bookstore/books/check/uuid/a6f7357f-6e7e-40e5-9b4a-c455c23b10a2");
+        boolean hasBook = localClient.get(boolean.class);
+        assertThat(hasBook, equalTo(false));
+    }
+    
+    @Test
+    public void testWebClientPipedDispatchBookId() throws Exception {
+        WebClient localClient = WebClient.create("local://books");
+        localClient.accept("text/plain");
+
+        localClient.path("bookstore/books/check/uuid/a6f7357f-6e7e-40e5-9b4a-c455c23b10a2");
+        boolean hasBook = localClient.get(boolean.class);
+        assertThat(hasBook, equalTo(false));
+    }
+
     @Test
     public void testWebClientDirectDispatchBookType() throws Exception {
         WebClient localClient = WebClient.create("local://books",


[cxf] 02/02: Recording .gitmergeinfo Changes

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

reta pushed a commit to branch 3.6.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit dd42fa32d05e5d02490f3a00f1dfd9c165a54b84
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Oct 30 11:47:46 2022 -0400

    Recording .gitmergeinfo Changes
---
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitmergeinfo b/.gitmergeinfo
index f44298247a..ae5f5b434d 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -119,6 +119,7 @@ M b9569dad4a4636af572b23414a9ee8a67c2daee6
 M bbf73a155bf4d87d824e00e54c269fb4e697468e
 M c05666fc41161450258a48fbba6298f56d857a63
 M c0db9bdd8e92cb4c7be3a2570d6f89fadb362953
+M c378cb2326dde28f0c86e130791f31622b054c89
 M c4b52ceee197f4eff145496b35f92c6112225075
 M c5b7db5a4cceb3df6094ee38215725fd4ecc2b8c
 M ca46bebe06bc2732907e476bfe6116f09fbe1eb4