[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles EL related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new 044021ca1 WW-5233 Copies Tiles EL related tests 044021ca1 is described below commit 044021ca1a629c66f10d4ffd7e63ac00fb257c78 Author: Lukasz Lenart AuthorDate: Sun Oct 2 13:16:59 2022 +0200 WW-5233 Copies Tiles EL related tests --- .../apache/tiles/el/ELAttributeEvaluatorTest.java | 189 + .../org/apache/tiles/el/ELContextImplTest.java | 120 + .../tiles/el/JspExpressionFactoryFactoryTest.java | 84 ++ .../org/apache/tiles/el/ScopeELResolverTest.java | 175 .../tiles/el/TilesContextBeanELResolverTest.java | 299 + .../tiles/el/TilesContextELResolverTest.java | 189 + 6 files changed, 1056 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/el/ELAttributeEvaluatorTest.java b/plugins/tiles/src/test/java/org/apache/tiles/el/ELAttributeEvaluatorTest.java new file mode 100644 index 0..8c1c794ba --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/el/ELAttributeEvaluatorTest.java @@ -0,0 +1,189 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.el; + +import com.sun.el.ExpressionFactoryImpl; +import junit.framework.TestCase; +import org.apache.tiles.api.Attribute; +import org.apache.tiles.api.Expression; +import org.apache.tiles.request.ApplicationContext; +import org.apache.tiles.request.Request; +import org.easymock.EasyMock; + +import javax.el.ArrayELResolver; +import javax.el.BeanELResolver; +import javax.el.CompositeELResolver; +import javax.el.ELResolver; +import javax.el.ListELResolver; +import javax.el.MapELResolver; +import javax.el.ResourceBundleELResolver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Tests {@link ELAttributeEvaluator}. + */ +public class ELAttributeEvaluatorTest extends TestCase { + +/** + * The evaluator to test. + */ +private ELAttributeEvaluator evaluator; + +/** + * The request object to use. + */ +private Request request; + +/** {@inheritDoc} */ +@Override +protected void setUp() throws Exception { +super.setUp(); +evaluator = new ELAttributeEvaluator(); +Map requestScope = new HashMap<>(); +Map sessionScope = new HashMap<>(); +Map applicationScope = new HashMap<>(); +requestScope.put("object1", "value"); +sessionScope.put("object2", 1); +applicationScope.put("object3", 2.0F); +requestScope.put("paulaBean", new PaulaBean()); +request = EasyMock.createMock(Request.class); +EasyMock.expect(request.getContext("request")).andReturn(requestScope) +.anyTimes(); +EasyMock.expect(request.getContext("session")).andReturn(sessionScope) +.anyTimes(); +EasyMock.expect(request.getContext("application")).andReturn( +applicationScope).anyTimes(); +EasyMock.expect(request.getAvailableScopes()).andReturn( +Arrays.asList("request", "session", "application")).anyTimes(); +ApplicationContext applicationContext = EasyMock +.createMock(ApplicationContext.class); +EasyMock.expect(request.getApplicationContext()).andReturn( +applicationContext).anyTimes(); +EasyMock.replay(request, applicationContext); + +evaluator.setExpressionFactory(new ExpressionFactoryImpl()); +ELResolver elResolver = new CompositeELResolver() { +{ +BeanELResolver beanElResolver = new BeanELResolver(false); +add(new ScopeELResolver()); +add(new TilesContextELResolver(beanElResolver)); +add(new TilesContextBeanELResolver()); +add(new ArrayELResolver(false)); +add(new ListELResolver(false)); +add(new MapELResolver(false)); +add(new ResourceBundleELResolver()); +add(b
[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles OGNL related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new 3207bfd0e WW-5233 Copies Tiles OGNL related tests 3207bfd0e is described below commit 3207bfd0ed44139c4de81d8daccb53a60ca84582 Author: Lukasz Lenart AuthorDate: Sun Oct 2 13:27:34 2022 +0200 WW-5233 Copies Tiles OGNL related tests --- .../tiles/ognl/AnyScopePropertyAccessorTest.java | 152 ++ .../tiles/ognl/DelegatePropertyAccessorTest.java | 111 ++ .../NestedObjectDelegatePropertyAccessorTest.java | 106 ++ .../tiles/ognl/OGNLAttributeEvaluatorTest.java | 229 + .../tiles/ognl/ScopePropertyAccessorTest.java | 91 ...pplicationContextNestedObjectExtractorTest.java | 51 + ...ContextPropertyAccessorDelegateFactoryTest.java | 189 + 7 files changed, 929 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/ognl/AnyScopePropertyAccessorTest.java b/plugins/tiles/src/test/java/org/apache/tiles/ognl/AnyScopePropertyAccessorTest.java new file mode 100644 index 0..c7f3465cc --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/ognl/AnyScopePropertyAccessorTest.java @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.ognl; + +import org.apache.tiles.request.Request; +import org.junit.Before; +import org.junit.Test; + +import java.util.Arrays; +import java.util.Map; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +/** + * Tests {@link AnyScopePropertyAccessor}. + */ +public class AnyScopePropertyAccessorTest { + +/** + * The accessor to test. + */ +private AnyScopePropertyAccessor accessor; + +/** + * Sets up the test. + */ +@Before +public void setUp() { +accessor = new AnyScopePropertyAccessor(); +} + +/** + * Test method for {@link AnyScopePropertyAccessor#getProperty(Map, Object, Object)}. + */ +@Test +public void testGetProperty() { +Request request = createMock(Request.class); +Map oneScope = createMock(Map.class); +Map twoScope = createMock(Map.class); + +expect(request.getAvailableScopes()).andReturn(Arrays.asList("one", "two")).anyTimes(); +expect(request.getContext("one")).andReturn(oneScope).anyTimes(); +expect(request.getContext("two")).andReturn(twoScope).anyTimes(); +expect(oneScope.containsKey("name1")).andReturn(true); +expect(oneScope.get("name1")).andReturn("value1"); +expect(oneScope.containsKey("name2")).andReturn(false); +expect(oneScope.containsKey("name3")).andReturn(false); +expect(twoScope.containsKey("name2")).andReturn(true); +expect(twoScope.get("name2")).andReturn("value2"); +expect(twoScope.containsKey("name3")).andReturn(false); + +replay(request, oneScope, twoScope); +assertEquals("value1", accessor.getProperty(null, request, "name1")); +assertEquals("value2", accessor.getProperty(null, request, "name2")); +assertNull(accessor.getProperty(null, request, "name3")); +verify(request, oneScope, twoScope); +} + +@Test +public void testGetSourceAccessor() { +Request request = createMock(Request.class); +Map oneScope = createMock(Map.class); +Map twoScope = createMock(Map.class); + +expect(request.getAvailableScopes()).andReturn(Arrays.asList("one", "two")).anyTimes(); +expect(request.getContext("one")).andReturn(oneScope).anyTimes(); +expect(request.getContext("two")).andReturn(twoScope).anyTimes(); +expect(oneScope.containsKey("name1")).andReturn(true); +expect(oneScope.containsKey("name2")).andReturn(false); +expect(oneScope.containsKey("name3")).andReturn(false)
[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles Template related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new fa7d76951 WW-5233 Copies Tiles Template related tests fa7d76951 is described below commit fa7d7695125ab06b351b7ff8c76163a6237d4144 Author: Lukasz Lenart AuthorDate: Sun Oct 2 13:41:49 2022 +0200 WW-5233 Copies Tiles Template related tests --- .../tiles/template/AddAttributeModelTest.java | 111 .../tiles/template/AddListAttributeModelTest.java | 86 ++ .../tiles/template/ComposeStackUtilTest.java | 123 .../template/DefaultAttributeResolverTest.java | 155 ++ .../apache/tiles/template/DefinitionModelTest.java | 98 +++ .../tiles/template/GetAsStringModelTest.java | 140 + .../tiles/template/ImportAttributeModelTest.java | 316 + .../tiles/template/InsertAttributeModelTest.java | 131 + .../tiles/template/InsertDefinitionModelTest.java | 90 ++ .../tiles/template/InsertTemplateModelTest.java| 89 ++ .../tiles/template/PutAttributeModelTest.java | 93 ++ .../tiles/template/PutListAttributeModelTest.java | 93 ++ .../template/SetCurrentContainerModelTest.java | 84 ++ 13 files changed, 1609 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java b/plugins/tiles/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java new file mode 100644 index 0..86da5 --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/template/AddAttributeModelTest.java @@ -0,0 +1,111 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.template; + +import org.apache.tiles.api.Attribute; +import org.apache.tiles.api.ListAttribute; +import org.apache.tiles.autotag.core.runtime.ModelBody; +import org.apache.tiles.request.Request; +import org.junit.Before; +import org.junit.Test; + +import java.io.IOException; +import java.util.ArrayDeque; +import java.util.Deque; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; + +/** + * Tests {@link AddAttributeModel}. + */ +public class AddAttributeModelTest { + +/** + * The model to test. + */ +private AddAttributeModel model; + +/** + * Sets up the test. + */ +@Before +public void setUp() { +model = new AddAttributeModel(); +} + +/** + * Test method for {@link AddAttributeModel + * #execute(java.lang.Object, java.lang.String, java.lang.String, java.lang.String, + * Request, ModelBody)}. + * + * @throws IOException If something goes wrong. + */ +@Test +public void testExecute() throws IOException { +Request request = createMock(Request.class); +ModelBody modelBody = createMock(ModelBody.class); +Deque composeStack = new ArrayDeque<>(); +ListAttribute listAttribute = new ListAttribute(); +Attribute attribute; +composeStack.push(listAttribute); +Map requestScope = new HashMap<>(); +requestScope.put(ComposeStackUtil.COMPOSE_STACK_ATTRIBUTE_NAME, composeStack); + +expect(request.getContext("request")).andReturn(requestScope).times(2); +expect(modelBody.evaluateAsString()).andReturn(null); +expect(modelBody.evaluateAsString()).andReturn("myBody"); + +replay(request, modelBody); +model.execute("myValue", "myExpression", "myRole", "myType", +request, modelBody); +List attributes = listAttribute.getValue(); +assertEquals(1, attributes.size()); +attribute = attributes.iterator().next(); +assertEquals("myValue", attribute.getValue()); +assertEquals("myExpression", attribute.getExpressionObject().getExpression()); +assertEquals("myRol
[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles Servlet related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new 17cd2e3d2 WW-5233 Copies Tiles Servlet related tests 17cd2e3d2 is described below commit 17cd2e3d2f37303dac7e6f7ea3a093463b6444d3 Author: Lukasz Lenart AuthorDate: Sun Oct 2 13:45:09 2022 +0200 WW-5233 Copies Tiles Servlet related tests --- .../web/startup/AbstractTilesListenerTest.java | 61 ++ 1 file changed, 61 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/web/startup/AbstractTilesListenerTest.java b/plugins/tiles/src/test/java/org/apache/tiles/web/startup/AbstractTilesListenerTest.java new file mode 100644 index 0..dbf6f3ec2 --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/web/startup/AbstractTilesListenerTest.java @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.web.startup; + +import org.apache.tiles.core.startup.TilesInitializer; +import org.apache.tiles.request.servlet.ServletApplicationContext; +import org.junit.Test; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.createMockBuilder; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.isA; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; + +/** + * Tests {@link AbstractTilesListener}. + */ +public class AbstractTilesListenerTest { + +/** + * Test method for {@link AbstractTilesListener#contextInitialized(ServletContextEvent)}. + */ +@Test +public void testContextInitialized() { +AbstractTilesListener listener = createMockBuilder(AbstractTilesListener.class).createMock(); +ServletContextEvent event = createMock(ServletContextEvent.class); +ServletContext servletContext = createMock(ServletContext.class); +TilesInitializer initializer = createMock(TilesInitializer.class); + +expect(event.getServletContext()).andReturn(servletContext); +expect(listener.createTilesInitializer()).andReturn(initializer); +initializer.initialize(isA(ServletApplicationContext.class)); +initializer.destroy(); + +replay(listener, event, servletContext, initializer); +listener.contextInitialized(event); +listener.contextDestroyed(event); +verify(listener, event, servletContext, initializer); +} + +}
[struts] branch WW-5233-tiles updated: WW-5233 Upgrades Easymock to version 4.3 to support Java 17
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new ffe556262 WW-5233 Upgrades Easymock to version 4.3 to support Java 17 ffe556262 is described below commit ffe556262242e5db0339600729bddc7ec27d42b4 Author: Lukasz Lenart AuthorDate: Sun Oct 2 13:53:54 2022 +0200 WW-5233 Upgrades Easymock to version 4.3 to support Java 17 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7770bf8c3..d6fed7576 100644 --- a/pom.xml +++ b/pom.xml @@ -804,7 +804,7 @@ org.easymock easymock -4.2 +4.3 test
[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles Autotag related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new e8e514eee WW-5233 Copies Tiles Autotag related tests e8e514eee is described below commit e8e514eee667266d49475b1930024b9e38d5c7e0 Author: Lukasz Lenart AuthorDate: Sun Oct 2 14:53:17 2022 +0200 WW-5233 Copies Tiles Autotag related tests --- .../core/internal/AnnotatedExampleModel.java | 40 ++ .../autotag/core/internal/ExampleExcluded.java | 39 ++ .../core/internal/ExampleExecutableModel.java | 36 + .../tiles/autotag/core/internal/ExampleModel.java | 39 ++ .../autotag/core/internal/ExampleRequest.java | 23 .../core/internal/NotFeasibleExampleModel.java | 34 + .../tiles/autotag/model/TemplateClassTest.java | 153 + .../tiles/autotag/model/TemplateMethodTest.java| 132 ++ .../tiles/autotag/model/TemplateParameterTest.java | 88 .../tiles/autotag/model/TemplateSuiteTest.java | 112 +++ 10 files changed, 696 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/AnnotatedExampleModel.java b/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/AnnotatedExampleModel.java new file mode 100644 index 0..99291461b --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/AnnotatedExampleModel.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.autotag.core.internal; + +import org.apache.tiles.autotag.core.runtime.ModelBody; +import org.apache.tiles.autotag.core.runtime.annotation.Parameter; + +/** + * Example start/stop template. + */ +public class AnnotatedExampleModel { + +/** + * It starts. + * + * @param one Parameter one. + * @param two Parameter two. + * @param request The request. + * @param modelBody The model body. + */ +public void execute(@Parameter(defaultValue = "hello", name = "alternateOne", required = true) String one, int two, ExampleRequest request, ModelBody modelBody) { +// Does nothing. +} +} diff --git a/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExcluded.java b/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExcluded.java new file mode 100644 index 0..2d310f705 --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExcluded.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.autotag.core.internal; + +import org.apache.tiles.autotag.core.runtime.ModelBody; + +/** + * Example start/stop template. + */ +public class ExampleExcluded { + +/** + * It starts. + * + * @param one Parameter one. + * @param two Parameter two. + * @param request The request. + * @param modelBody The model body. + */ +public void execute(String one, int two, ExampleRequest request, ModelBody modelBody) { +// Does nothing. +} +} diff --git a/plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExecutableModel.java b/plugins/tiles/src/test/java/org/apache/tiles/au
[struts] branch WW-5233-tiles updated (e8e514eee -> 567828244)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git discard e8e514eee WW-5233 Copies Tiles Autotag related tests new 567828244 WW-5233 Copies Tiles Autotag related tests This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (e8e514eee) \ N -- N -- N refs/heads/WW-5233-tiles (567828244) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 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: .../core/internal/AnnotatedExampleModel.java | 40 - .../autotag/core/internal/ExampleExcluded.java | 39 - .../core/internal/ExampleExecutableModel.java | 36 - .../tiles/autotag/core/internal/ExampleModel.java | 39 - .../autotag/core/internal/ExampleRequest.java | 23 --- .../core/internal/NotFeasibleExampleModel.java | 34 - .../autotag/runtime/AbstractModelBodyTest.java | 164 + .../runtime/util/NullWriterTest.java} | 44 -- 8 files changed, 197 insertions(+), 222 deletions(-) delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/AnnotatedExampleModel.java delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExcluded.java delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleExecutableModel.java delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleModel.java delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/ExampleRequest.java delete mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/core/internal/NotFeasibleExampleModel.java create mode 100644 plugins/tiles/src/test/java/org/apache/tiles/autotag/runtime/AbstractModelBodyTest.java copy plugins/tiles/src/test/java/org/apache/tiles/{core/definition/pattern/regexp/RegexpDefinitionPatternMatcherFactoryTest.java => autotag/runtime/util/NullWriterTest.java} (54%)
[struts] 01/01: WW-5233 Copies Tiles Autotag related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git commit 567828244b09f1b7d0b3e1a89633ff81d9ccddc3 Author: Lukasz Lenart AuthorDate: Sun Oct 2 14:53:17 2022 +0200 WW-5233 Copies Tiles Autotag related tests --- .../tiles/autotag/model/TemplateClassTest.java | 153 +++ .../tiles/autotag/model/TemplateMethodTest.java| 132 + .../tiles/autotag/model/TemplateParameterTest.java | 88 +++ .../tiles/autotag/model/TemplateSuiteTest.java | 112 ++ .../autotag/runtime/AbstractModelBodyTest.java | 164 + .../tiles/autotag/runtime/util/NullWriterTest.java | 71 + 6 files changed, 720 insertions(+) diff --git a/plugins/tiles/src/test/java/org/apache/tiles/autotag/model/TemplateClassTest.java b/plugins/tiles/src/test/java/org/apache/tiles/autotag/model/TemplateClassTest.java new file mode 100644 index 0..1b875c37d --- /dev/null +++ b/plugins/tiles/src/test/java/org/apache/tiles/autotag/model/TemplateClassTest.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tiles.autotag.model; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import static org.easymock.EasyMock.createMock; +import static org.easymock.EasyMock.expect; +import static org.easymock.EasyMock.replay; +import static org.easymock.EasyMock.verify; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +public class TemplateClassTest { + +/** + * Test method for {@link TemplateClass#TemplateClass(String)}. + */ +@Test +public void testTemplateConstructor1() { +TemplateClass templateClass = new TemplateClass("name"); +assertEquals("name", templateClass.getName()); +assertNull(templateClass.getTagName()); +assertNull(templateClass.getTagClassPrefix()); +assertNull(templateClass.getExecuteMethod()); +Collection params = templateClass.getParameters(); +assertTrue(params.isEmpty()); +} + +/** + * Test method for {@link TemplateClass#TemplateClass(String, String, String, TemplateMethod)}. + */ +@Test +public void testTemplateConstructor2() { +TemplateMethod method = createMock(TemplateMethod.class); + +replay(method); +TemplateClass templateClass = new TemplateClass("name", "tagName", "tagClassPrefix", method); +assertEquals("name", templateClass.getName()); +assertEquals("tagName", templateClass.getTagName()); +assertEquals("tagClassPrefix", templateClass.getTagClassPrefix()); +assertEquals(method, templateClass.getExecuteMethod()); +verify(method); +} + +/** + * Test method for {@link TemplateClass#getSimpleName()}. + */ +@Test +public void testGetSimpleName() { +TemplateClass templateClass = new TemplateClass("name"); +assertEquals("name", templateClass.getSimpleName()); +templateClass = new TemplateClass("org.whatever.Hello"); +assertEquals("Hello", templateClass.getSimpleName()); +} + +/** + * Test method for {@link TemplateClass#setDocumentation(String)}. + */ +@Test +public void testSetDocumentation() { +TemplateClass templateClass = new TemplateClass("name"); +templateClass.setDocumentation("docs"); +assertEquals("docs", templateClass.getDocumentation()); +} + +/** + * Test method for {@link TemplateClass#getParameters()}. + */ +@Test +public void testGetParameters() { +TemplateParameter param1 = createMock(TemplateParameter.class); +TemplateParameter param2 = createMock(TemplateParameter.class); +TemplateParameter param3 = createMock(TemplateParameter.class); +TemplateParameter param4 = createMock(TemplateParameter.class); +Tem
[struts] branch WW-5233-tiles updated: WW-5233 Drops useless @version tag and addresses some potential RegEx vulnerabilities
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new 30f8832be WW-5233 Drops useless @version tag and addresses some potential RegEx vulnerabilities 30f8832be is described below commit 30f8832be0b4e5eabd9aeb9c93e60d7ff2df6d21 Author: Lukasz Lenart AuthorDate: Sun Oct 2 18:43:45 2022 +0200 WW-5233 Drops useless @version tag and addresses some potential RegEx vulnerabilities --- .../main/java/org/apache/tiles/api/Attribute.java | 5 +- .../apache/tiles/api/preparer/ViewPreparer.java| 2 - .../autotag/core/runtime/AbstractModelBody.java| 2 - .../tiles/autotag/core/runtime/ModelBody.java | 2 - .../autotag/core/runtime/annotation/Parameter.java | 2 - .../autotag/core/runtime/util/NullWriter.java | 2 - .../apache/tiles/autotag/model/TemplateClass.java | 2 - .../apache/tiles/autotag/model/TemplateMethod.java | 2 - .../tiles/autotag/model/TemplateParameter.java | 2 - .../apache/tiles/autotag/model/TemplateSuite.java | 2 - .../tiles/core/definition/DefinitionsFactory.java | 2 - .../core/definition/NoSuchDefinitionException.java | 2 - .../UnresolvingLocaleDefinitionsFactory.java | 2 - .../digester/DigesterDefinitionsReader.java| 2 - .../DigesterDefinitionsReaderException.java| 2 - .../pattern/DefinitionPatternMatcher.java | 2 - .../pattern/DefinitionPatternMatcherFactory.java | 2 - .../org/apache/tiles/request/RequestException.java | 2 - .../NotAvailableFreemarkerServletException.java| 2 - .../autotag/FreemarkerAutotagException.java| 2 - .../render/AttributeValueFreemarkerServlet.java| 51 -- .../request/freemarker/render/package-info.java| 24 --- .../SharedVariableLoaderFreemarkerServlet.java | 200 - .../servlet/WebappClassTemplateLoader.java | 2 - .../tiles/request/jsp/JspPrintWriterAdapter.java | 2 - .../request/locale/URLApplicationResource.java | 2 - .../reflect/CannotInstantiateObjectException.java | 2 - .../tiles/request/render/DispatchRenderer.java | 2 - .../tiles/template/InsertAttributeModel.java | 2 - .../tiles/template/InsertDefinitionModel.java | 2 - 30 files changed, 2 insertions(+), 330 deletions(-) diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java index c49f07a96..e84039c73 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java @@ -19,6 +19,7 @@ package org.apache.tiles.api; +import com.opensymphony.xwork2.util.TextParseUtil; import org.apache.tiles.request.Request; import java.io.Serializable; @@ -205,9 +206,7 @@ public class Attribute implements Serializable, Cloneable { */ public void setRole(String role) { if (role != null && role.trim().length() > 0) { -String[] rolesStrings = role.split("\\s*,\\s*"); -roles = new HashSet<>(); -Collections.addAll(roles, rolesStrings); +roles = TextParseUtil.commaDelimitedStringToSet(role); } else { roles = null; } diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/preparer/ViewPreparer.java b/plugins/tiles/src/main/java/org/apache/tiles/api/preparer/ViewPreparer.java index 94527a45b..9abf720a6 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/preparer/ViewPreparer.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/preparer/ViewPreparer.java @@ -38,8 +38,6 @@ import org.apache.tiles.request.Request; ** * > - * - * @version $Rev$ $Date$ */ public interface ViewPreparer { diff --git a/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java b/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java index 1054f338a..72b3a9938 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/AbstractModelBody.java @@ -27,8 +27,6 @@ import java.util.regex.Pattern; /** * Base class for the abstraction of the body. - * - * @version $Rev$ $Date$ */ public abstract class AbstractModelBody implements ModelBody { diff --git a/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java b/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java index feedca8c8..0f97ec0d0 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/autotag/core/runtime/ModelBody.ja
[struts-examples] branch dependabot/maven/quarkus-plugin.version-2.13.0.Final created (now 1963fad)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/quarkus-plugin.version-2.13.0.Final in repository https://gitbox.apache.org/repos/asf/struts-examples.git at 1963fad Bump quarkus-plugin.version from 2.12.3.Final to 2.13.0.Final No new revisions were added by this update.
[struts-examples] branch dependabot/maven/org.slf4j-slf4j-simple-2.0.3 created (now 47fea51)
This is an automated email from the ASF dual-hosted git repository. github-bot pushed a change to branch dependabot/maven/org.slf4j-slf4j-simple-2.0.3 in repository https://gitbox.apache.org/repos/asf/struts-examples.git at 47fea51 Bump slf4j-simple from 2.0.2 to 2.0.3 No new revisions were added by this update.
[struts] branch WW-5233-tiles updated: WW-5233 Addresses bugs reported by Sonar
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new fb08d7bdf WW-5233 Addresses bugs reported by Sonar fb08d7bdf is described below commit fb08d7bdf030792065355801f4a5384d7abdc42e Author: Lukasz Lenart AuthorDate: Mon Oct 3 07:49:27 2022 +0200 WW-5233 Addresses bugs reported by Sonar --- .../main/java/org/apache/tiles/api/Attribute.java | 13 +-- .../apache/tiles/api/BasicAttributeContext.java| 22 +++-- .../main/java/org/apache/tiles/api/Definition.java | 6 ++ .../main/java/org/apache/tiles/api/Expression.java | 6 ++ .../java/org/apache/tiles/api/ListAttribute.java | 6 ++ .../autotag/core/runtime/AbstractModelBody.java| 11 +-- .../definition/dao/BaseLocaleUrlDefinitionDAO.java | 13 +-- .../tiles/request/collection/HeaderValuesMap.java | 94 +++--- .../apache/tiles/request/collection/KeySet.java| 13 ++- .../request/collection/ReadOnlyEnumerationMap.java | 93 ++--- .../java/org/apache/tiles/api/AttributeTest.java | 4 +- .../autotag/runtime/AbstractModelBodyTest.java | 7 -- 12 files changed, 190 insertions(+), 98 deletions(-) diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java index e84039c73..69209e5d4 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java @@ -23,8 +23,6 @@ import com.opensymphony.xwork2.util.TextParseUtil; import org.apache.tiles.request.Request; import java.io.Serializable; -import java.util.Collections; -import java.util.HashSet; import java.util.Iterator; import java.util.Objects; import java.util.Set; @@ -267,10 +265,7 @@ public class Attribute implements Serializable, Cloneable { */ @Override public String toString() { -if (value != null) { -return value.toString(); -} -return null; +return Objects.toString(value); } /** @@ -323,6 +318,12 @@ public class Attribute implements Serializable, Cloneable { */ @Override public boolean equals(Object obj) { +if (obj == null && value == null) { +return true; +} +if (!(obj instanceof Attribute)) { +return false; +} Attribute attribute = (Attribute) obj; return Objects.equals(value, attribute.value) && Objects.equals(renderer, attribute.renderer) diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java b/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java index 8fdc5b8aa..9de064d6b 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java @@ -149,7 +149,9 @@ public class BasicAttributeContext implements AttributeContext, Serializable { */ public void inheritCascadedAttributes(AttributeContext context) { if (context instanceof BasicAttributeContext) { -copyCascadedAttributes((BasicAttributeContext) context); +if (((BasicAttributeContext) context).cascadedAttributes != null && !((BasicAttributeContext) context).cascadedAttributes.isEmpty()) { +cascadedAttributes = deepCopyAttributeMap(((BasicAttributeContext) context).cascadedAttributes); +} } else { this.cascadedAttributes = new HashMap<>(); Set parentAttributeNames = context.getCascadedAttributeNames(); @@ -353,6 +355,12 @@ public class BasicAttributeContext implements AttributeContext, Serializable { */ @Override public boolean equals(Object obj) { +if (obj == null) { +return false; +} +if (!(obj instanceof BasicAttributeContext)) { +return false; +} BasicAttributeContext bac = (BasicAttributeContext) obj; return Objects.equals(templateAttribute, bac.templateAttribute) && Objects.equals(preparer, bac.preparer) @@ -400,17 +408,7 @@ public class BasicAttributeContext implements AttributeContext, Serializable { if (context.attributes != null && !context.attributes.isEmpty()) { attributes = deepCopyAttributeMap(context.attributes); } -copyCascadedAttributes(context); -} - -/** - * Copies the cascaded attributes to the current context. - * - * @param context The context to copy from. - */ -private void copyCascadedAttributes(BasicAttributeContext context) { -if (context.cascadedAttributes != null -&& !context.cascadedAttributes.isEmpty()) { +if (context.cascadedAttributes != n
[struts] branch WW-5233-tiles updated: WW-5233 Addresses a few code smells
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new e9cad7ab3 WW-5233 Addresses a few code smells e9cad7ab3 is described below commit e9cad7ab3cbb3fe5e447015b2101b67b85f00b76 Author: Lukasz Lenart AuthorDate: Mon Oct 3 08:09:34 2022 +0200 WW-5233 Addresses a few code smells --- .../src/main/java/org/apache/tiles/api/Attribute.java | 18 ++ .../org/apache/tiles/api/BasicAttributeContext.java| 4 ++-- .../main/java/org/apache/tiles/api/ListAttribute.java | 9 - .../test/java/org/apache/tiles/api/AttributeTest.java | 2 +- .../java/org/apache/tiles/api/ListAttributeTest.java | 2 +- .../request/collection/HeaderValuesCollectionTest.java | 4 ++-- .../collection/HeaderValuesMapEntrySetTest.java| 4 ++-- .../apache/tiles/request/collection/KeySetTest.java| 2 +- .../ReadOnlyEnumerationMapValuesCollectionTest.java| 6 -- 9 files changed, 23 insertions(+), 28 deletions(-) diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java index 69209e5d4..65be6537a 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/Attribute.java @@ -22,7 +22,6 @@ package org.apache.tiles.api; import com.opensymphony.xwork2.util.TextParseUtil; import org.apache.tiles.request.Request; -import java.io.Serializable; import java.util.Iterator; import java.util.Objects; import java.util.Set; @@ -30,7 +29,7 @@ import java.util.Set; /** * Common implementation of attribute definition. */ -public class Attribute implements Serializable, Cloneable { +public class Attribute { /** * The name of the template renderer. @@ -42,20 +41,19 @@ public class Attribute implements Serializable, Cloneable { * * @since 2.0.6 */ -protected Set roles = null; +private Set roles = null; /** * The value of the attribute. */ -protected Object value = null; +private Object value = null; /** - * The expression to evaluate. Ignored if {@link #value} is not - * null. + * The expression to evaluate. Ignored if {@link #value} is not null. * * @since 2.2.0 */ -protected Expression expressionObject = null; +private Expression expressionObject = null; /** * The renderer name of the attribute. Default names are string, @@ -362,11 +360,7 @@ public class Attribute implements Serializable, Cloneable { + Objects.hashCode(roles) + Objects.hashCode(expressionObject); } -/** - * {@inheritDoc} - */ -@Override -public Attribute clone() { +public Attribute copy() { return new Attribute(this); } } diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java b/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java index 9de064d6b..cd12ea860 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/BasicAttributeContext.java @@ -232,7 +232,7 @@ public class BasicAttributeContext implements AttributeContext, Serializable { /** * Add all attributes to this context. - * Copies all of the mappings from the specified attribute map to this context. + * Copies all the mappings from the specified attribute map to this context. * New attribute mappings will replace any mappings that this context had for any of the keys * currently in the specified attribute map. * @@ -454,7 +454,7 @@ public class BasicAttributeContext implements AttributeContext, Serializable { for (Map.Entry entry : attributes.entrySet()) { Attribute toCopy = entry.getValue(); if (toCopy != null) { -retValue.put(entry.getKey(), toCopy.clone()); +retValue.put(entry.getKey(), toCopy.copy()); } } return retValue; diff --git a/plugins/tiles/src/main/java/org/apache/tiles/api/ListAttribute.java b/plugins/tiles/src/main/java/org/apache/tiles/api/ListAttribute.java index 227380af0..67b329443 100644 --- a/plugins/tiles/src/main/java/org/apache/tiles/api/ListAttribute.java +++ b/plugins/tiles/src/main/java/org/apache/tiles/api/ListAttribute.java @@ -61,7 +61,7 @@ public class ListAttribute extends Attribute { List attributes = new ArrayList<>(attributesToCopy.size()); for (Attribute attribute : attributesToCopy) { if (attribute != null) { -attributes.add(attribute.clone()); +attributes.add(attribute.copy()); } else {
[struts-examples] branch master updated (629cca9 -> c6024cc)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts-examples.git from 629cca9 Extends example with using multiple actions per form add 1963fad Bump quarkus-plugin.version from 2.12.3.Final to 2.13.0.Final add c6024cc Merge pull request #184 from apache/dependabot/maven/quarkus-plugin.version-2.13.0.Final No new revisions were added by this update. Summary of changes: quarkus/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[struts-examples] branch master updated (c6024cc -> 1e53bd4)
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/struts-examples.git from c6024cc Merge pull request #184 from apache/dependabot/maven/quarkus-plugin.version-2.13.0.Final add 47fea51 Bump slf4j-simple from 2.0.2 to 2.0.3 add 1e53bd4 Merge pull request #185 from apache/dependabot/maven/org.slf4j-slf4j-simple-2.0.3 No new revisions were added by this update. Summary of changes: portlet/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[struts] branch WW-5233-tiles updated: WW-5233 Copies Tiles Portal related tests
This is an automated email from the ASF dual-hosted git repository. lukaszlenart pushed a commit to branch WW-5233-tiles in repository https://gitbox.apache.org/repos/asf/struts.git The following commit(s) were added to refs/heads/WW-5233-tiles by this push: new d0b153a7b WW-5233 Copies Tiles Portal related tests d0b153a7b is described below commit d0b153a7b5639be80aa237fb6136cd91e4976418 Author: Lukasz Lenart AuthorDate: Mon Oct 3 08:52:41 2022 +0200 WW-5233 Copies Tiles Portal related tests --- plugins/portlet-tiles/pom.xml | 5 + .../portlet/delegate/StateAwareParameterMap.java | 112 -- .../delegate/StateAwareRequestDelegate.java| 83 .../delegate/StateAwareResponseDelegate.java | 57 --- .../extractor/StateAwareParameterExtractor.java| 2 +- .../tiles/request/portlet/PortletRequestTest.java | 424 + .../request/portlet/RenderPortletRequestTest.java | 69 .../portlet/delegate/MimeResponseDelegateTest.java | 132 +++ .../delegate/PortletRequestDelegateTest.java | 83 .../extractor/ApplicationScopeExtractorTest.java | 106 ++ .../portlet/extractor/HeaderExtractorTest.java | 117 ++ .../extractor/InitParameterExtractorTest.java | 83 .../portlet/extractor/ParameterExtractorTest.java | 83 .../extractor/RequestScopeExtractorTest.java | 107 ++ .../extractor/SessionScopeExtractorTest.java | 154 .../StateAwareParameterExtractorTest.java} | 37 +- .../request/collection/ReadOnlyEnumerationMap.java | 5 +- 17 files changed, 1385 insertions(+), 274 deletions(-) diff --git a/plugins/portlet-tiles/pom.xml b/plugins/portlet-tiles/pom.xml index 558244064..99779d591 100644 --- a/plugins/portlet-tiles/pom.xml +++ b/plugins/portlet-tiles/pom.xml @@ -50,6 +50,11 @@ portlet-api provided + +org.easymock +easymock +test + UTF-8 diff --git a/plugins/portlet-tiles/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareParameterMap.java b/plugins/portlet-tiles/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareParameterMap.java deleted file mode 100644 index 34e36bb31..0 --- a/plugins/portlet-tiles/src/main/java/org/apache/tiles/request/portlet/delegate/StateAwareParameterMap.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * $Id$ - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tiles.request.portlet.delegate; - -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -/** - * Parameter map to be used when the response is a {@link javax.portlet.StateAwareResponse}. - */ -public class StateAwareParameterMap implements Map { - -/** - * The request parameter map. - */ -private final Map requestMap; - -/** - * The response parameter map. - */ -private final Map responseMap; - -/** - * Constructor. - * - * @param requestMap The request parameter map. - * @param responseMap The response parameter map. - */ -public StateAwareParameterMap(Map requestMap, Map responseMap) { -this.requestMap = requestMap; -this.responseMap = responseMap; -} - -@Override -public void clear() { -responseMap.clear(); -} - -@Override -public boolean containsKey(Object key) { -return requestMap.containsKey(key); -} - -@Override -public boolean containsValue(Object value) { -return requestMap.containsValue(value); -} - -@Override -public Set> entrySet() { -return requestMap.entrySet(); -} - -@Override -public String[] get(Object key) { -return requestMap.get(key); -} - -@Override -public boolean isEmpty() { -return requestMap.isEmpty(); -} - -@Override -public Set keySet() { -return requestMap.keySet(); -} - -@Override -public String[] put(String key, String[] value) { -return responseMap.put(key, value); -} - -@Override -public void putAll(Map m) { -responseMap.putAll(m); -} - -