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 20:34:15 UTC

[cxf] branch 3.4.x-fixes updated (4ff32e6cf0 -> 9daecbfa3c)

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

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


    from 4ff32e6cf0 Recording .gitmergeinfo Changes
     new f419ce3ce7 Added more test for using factory methods as parameter converters (#1004)
     new 9daecbfa3c 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.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit f419ce3ce7e758fbf7d466271c1011e3f476b7bb
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 07ba522dfd4bd3483b46e98b7fabddfc23f74288)
---
 .../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.4.x-fixes
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit 9daecbfa3cf3d049a4019b3079b9ab831a783d05
Author: Andriy Redko <dr...@gmail.com>
AuthorDate: Sun Oct 30 16:34:05 2022 -0400

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

diff --git a/.gitmergeinfo b/.gitmergeinfo
index 183addf645..0a078acf8e 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -195,6 +195,7 @@ B e4b56ffecdb410df90d7fb5a8c12982d9e421c0d
 B e713fd34837af629711a16a7e376b0a090a393c7
 B e7f7b2154ed9f5668a62a7e99f862ca1aef7cd43
 B e85178929cac18f07e72b67bbc17ec34f0a517a6
+B e9f7d1c11998c3d87d71b46d1e877273dfb10c3e
 B ebcb82036cd653ff1c29abff2da57c8af8fb53f8
 B ebf96ece52588ae1509d1fbe63fae43571c18116
 B ec8dc6db5d7f574a077ccd3afcd847c744b9b7a8