From 1f0a8a7eb377c09aaff055969cf966737c56a91b Mon Sep 17 00:00:00 2001 From: y2k2mt Date: Sun, 24 Dec 2023 11:08:06 +0900 Subject: [PATCH 1/9] update parent pom --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7df3fe9..0c1dbbb 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.analogweb analogweb-core jar - 0.11.2-SNAPSHOT + 0.12.0-SNAPSHOT analogweb-core http://analogweb.org @@ -50,7 +50,7 @@ org.analogweb analogweb-parent-modules - 18 + 20-SNAPSHOT From cf0b1639a4874bbbe2d36236058fc950654ac6e9 Mon Sep 17 00:00:00 2001 From: y2k2mt Date: Sun, 24 Dec 2023 11:14:20 +0900 Subject: [PATCH 2/9] WIP:replace mockito matcher api --- .../BeanAttributeArgumentPreparatorTest.java | 4 +-- .../analogweb/core/DefaultInvokerTest.java | 4 +-- .../core/DefaultModulesBuilderTest.java | 2 +- .../core/DefaultRouteRegistryTest.java | 28 +++++++------------ .../core/ScopedMapArgumentPreparatorTest.java | 4 +-- 5 files changed, 17 insertions(+), 25 deletions(-) diff --git a/src/test/java/org/analogweb/core/BeanAttributeArgumentPreparatorTest.java b/src/test/java/org/analogweb/core/BeanAttributeArgumentPreparatorTest.java index f343d36..2c9f5f5 100644 --- a/src/test/java/org/analogweb/core/BeanAttributeArgumentPreparatorTest.java +++ b/src/test/java/org/analogweb/core/BeanAttributeArgumentPreparatorTest.java @@ -2,8 +2,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/analogweb/core/DefaultInvokerTest.java b/src/test/java/org/analogweb/core/DefaultInvokerTest.java index ac8a4f6..a97d85f 100644 --- a/src/test/java/org/analogweb/core/DefaultInvokerTest.java +++ b/src/test/java/org/analogweb/core/DefaultInvokerTest.java @@ -2,8 +2,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; diff --git a/src/test/java/org/analogweb/core/DefaultModulesBuilderTest.java b/src/test/java/org/analogweb/core/DefaultModulesBuilderTest.java index 9c76c89..194f000 100644 --- a/src/test/java/org/analogweb/core/DefaultModulesBuilderTest.java +++ b/src/test/java/org/analogweb/core/DefaultModulesBuilderTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/analogweb/core/DefaultRouteRegistryTest.java b/src/test/java/org/analogweb/core/DefaultRouteRegistryTest.java index 07ed84b..64b3c83 100644 --- a/src/test/java/org/analogweb/core/DefaultRouteRegistryTest.java +++ b/src/test/java/org/analogweb/core/DefaultRouteRegistryTest.java @@ -3,6 +3,8 @@ import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; +import static org.mockito.ArgumentMatchers.anyMap; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -15,8 +17,6 @@ import org.analogweb.RequestPathMetadata; import org.junit.Before; import org.junit.Test; -import static org.mockito.Matchers.anyMapOf; -import static org.mockito.Matchers.eq; /** * @author snowgoose @@ -49,20 +49,17 @@ public void testGetMetadata() { InvocationMetadataFinder finder1 = mock(InvocationMetadataFinder.class); when( finder1.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); InvocationMetadataFinder finder2 = mock(InvocationMetadataFinder.class); when( finder2.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(metadata2); InvocationMetadataFinder finder3 = mock(InvocationMetadataFinder.class); when( finder3.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); assertThat( registry.findInvocationMetadata(context, @@ -87,20 +84,17 @@ public void testGetNothing() { InvocationMetadataFinder finder1 = mock(InvocationMetadataFinder.class); when( finder1.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); InvocationMetadataFinder finder2 = mock(InvocationMetadataFinder.class); when( finder2.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); InvocationMetadataFinder finder3 = mock(InvocationMetadataFinder.class); when( finder3.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); assertThat( registry.findInvocationMetadata(context, @@ -126,14 +120,12 @@ public void testGetCacheable() { InvocationMetadataFinder finder2 = mock(InvocationMetadataFinder.class); when( finder2.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(null); InvocationMetadataFinder finder3 = mock(InvocationMetadataFinder.class); when( finder3.find( - anyMapOf(RequestPathMetadata.class, - InvocationMetadata.class), eq(context))) + anyMap(), eq(context))) .thenReturn(metadata3); when(metadata3.getCachable()).thenReturn(metadata1); assertThat( diff --git a/src/test/java/org/analogweb/core/ScopedMapArgumentPreparatorTest.java b/src/test/java/org/analogweb/core/ScopedMapArgumentPreparatorTest.java index eeab5d0..d56d6d6 100644 --- a/src/test/java/org/analogweb/core/ScopedMapArgumentPreparatorTest.java +++ b/src/test/java/org/analogweb/core/ScopedMapArgumentPreparatorTest.java @@ -2,8 +2,8 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; From 2a50c252b8407c39db922d152aa836ac5d6995ff Mon Sep 17 00:00:00 2001 From: y2k2mt Date: Sun, 24 Dec 2023 11:16:10 +0900 Subject: [PATCH 3/9] no support for javax.xml on java11 --- .../java/integration/testcase/FooBean.java | 5 --- .../core/response/AcceptableTest.java | 40 ------------------- 2 files changed, 45 deletions(-) diff --git a/src/test/java/integration/testcase/FooBean.java b/src/test/java/integration/testcase/FooBean.java index e4d010f..8dc258c 100644 --- a/src/test/java/integration/testcase/FooBean.java +++ b/src/test/java/integration/testcase/FooBean.java @@ -1,12 +1,7 @@ package integration.testcase; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement public class FooBean { - @XmlElement private String baa = "baz"; public String getBaa() { diff --git a/src/test/java/org/analogweb/core/response/AcceptableTest.java b/src/test/java/org/analogweb/core/response/AcceptableTest.java index 420a13f..21bb266 100644 --- a/src/test/java/org/analogweb/core/response/AcceptableTest.java +++ b/src/test/java/org/analogweb/core/response/AcceptableTest.java @@ -11,9 +11,6 @@ import java.util.Collections; import java.util.List; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - import org.analogweb.Renderable; import org.analogweb.Headers; import org.analogweb.RequestContext; @@ -41,40 +38,6 @@ public void setUp() throws Exception { headers = mock(Headers.class); } - @Test - public void testRenderAcceptableXMLWithReplacedFormatter() throws Exception { - final Member m = new Member("snowgoose", 34); - Acceptable a = Acceptable.as(m); - a.map(new Renderable() { - - @Override - public Response render(RequestContext context, - ResponseContext response) throws IOException, - WebApplicationException { - return new DefaultResponse(new DefaultResponseEntity( - "write with XML")); - } - }, "text/xml"); - final String actual = schenarioRender(" text/xml", m, a); - assertThat(actual, is("write with XML")); - } - - @Test - public void testRenderAcceptableSecondXML() throws Exception { - final Member m = new Member("snowgoose", 34); - final String actual = schenarioRender( - " text/x-dvi; q=0.8, application/xml, */*", m); - assertThat(actual, is("{\"age\": 34,\"name\": \"snowgoose\"}")); - } - - @Test - public void testRenderAcceptableXMLWithQuality() throws Exception { - final Member m = new Member("snowgoose", 34); - final String actual = schenarioRender( - " text/x-dvi; q=0.8, text/xml; q=6, */*", m); - assertThat(actual, is("{\"age\": 34,\"name\": \"snowgoose\"}")); - } - @Test public void testRenderAcceptableJSON() throws Exception { final Member m = new Member("snowgoose", 34); @@ -226,12 +189,9 @@ public void testComparator() { assertThat(accepts.get(5), is(" */*")); } - @XmlRootElement public static class Member { - @XmlElement private String name; - @XmlElement private int age; public Member() { From eb5eb30b4f5d2d643b52b746e08feddc51e952dd Mon Sep 17 00:00:00 2001 From: y2k2mt Date: Sun, 24 Dec 2023 11:26:29 +0900 Subject: [PATCH 4/9] fix javadoc errors --- src/main/java/org/analogweb/ResponseHandler.java | 4 ++-- src/main/java/org/analogweb/RouteRegistry.java | 4 ++-- src/main/java/org/analogweb/core/package-info.java | 2 +- src/main/java/org/analogweb/package-info.java | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/analogweb/ResponseHandler.java b/src/main/java/org/analogweb/ResponseHandler.java index e8a4f61..1f02f81 100644 --- a/src/main/java/org/analogweb/ResponseHandler.java +++ b/src/main/java/org/analogweb/ResponseHandler.java @@ -3,11 +3,11 @@ import java.io.IOException; /** - * Handle {@link Renderable}.
+ * Handle {@link Renderable}. * Usually,this handler executes only * {@link Renderable#render(RequestContext, ResponseContext)}. * - * @author snowgoose + * @author y2k2mt */ public interface ResponseHandler extends Module { diff --git a/src/main/java/org/analogweb/RouteRegistry.java b/src/main/java/org/analogweb/RouteRegistry.java index 6fbee0f..7d14a25 100644 --- a/src/main/java/org/analogweb/RouteRegistry.java +++ b/src/main/java/org/analogweb/RouteRegistry.java @@ -5,12 +5,12 @@ /** * Registry of {@link InvocationMetadata}. * - * @author snowgoose + * @author y2k2mt */ public interface RouteRegistry extends Disposable { /** - * Find matched {@link InvocationMetadata}.
+ * Find matched {@link InvocationMetadata}. * * @param requestContext * {@link RequestContext} diff --git a/src/main/java/org/analogweb/core/package-info.java b/src/main/java/org/analogweb/core/package-info.java index 478c787..6ad7cdc 100644 --- a/src/main/java/org/analogweb/core/package-info.java +++ b/src/main/java/org/analogweb/core/package-info.java @@ -1,5 +1,5 @@ /** - * Analogweb's core (default) implementations.
+ * Analogweb's core (default) implementations. * These instance are recognized by an application automatically. */ package org.analogweb.core; diff --git a/src/main/java/org/analogweb/package-info.java b/src/main/java/org/analogweb/package-info.java index d22d539..261115f 100644 --- a/src/main/java/org/analogweb/package-info.java +++ b/src/main/java/org/analogweb/package-info.java @@ -1,5 +1,5 @@ /** - * Root of Analog Web Framework
+ * Root of Analog Web Framework * This package defines fundamental interfaces. */ package org.analogweb; From a2e84d809bd7d25845cec1e25997a28d58a1fb62 Mon Sep 17 00:00:00 2001 From: y2k2mt Date: Sun, 24 Dec 2023 13:38:52 +0900 Subject: [PATCH 5/9] update parent pom --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0c1dbbb..9edced2 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@