mirror of
https://github.com/apache/struts.git
synced 2026-08-05 14:47:09 +00:00
WW-5532 Upgrade and align various dependencies
This commit is contained in:
@@ -99,7 +99,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+2
-1
@@ -229,7 +229,8 @@ public class StrutsParametersTest {
|
||||
}
|
||||
|
||||
private void assertText(Map<String, String> params, String text) throws IOException {
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(ParameterUtils.getBaseUrl()).path("/paramsannotation/test.action");
|
||||
UriComponentsBuilder builder = UriComponentsBuilder.fromUriString(ParameterUtils.getBaseUrl())
|
||||
.path("/paramsannotation/test.action");
|
||||
params.forEach(builder::queryParam);
|
||||
String url = builder.toUriString();
|
||||
HtmlPage page = webClient.getPage(url);
|
||||
|
||||
@@ -229,6 +229,7 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>compile</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -37,11 +37,9 @@
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.validation</groupId>
|
||||
<artifactId>jakarta.validation-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -55,29 +53,24 @@
|
||||
<artifactId>jakarta.el</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>2.3.1</version>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-core</artifactId>
|
||||
<version>2.3.0.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.xml.bind</groupId>
|
||||
<artifactId>jaxb-impl</artifactId>
|
||||
<version>2.3.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.activation</groupId>
|
||||
<artifactId>activation</artifactId>
|
||||
<version>1.1.1</version>
|
||||
<groupId>jakarta.activation</groupId>
|
||||
<artifactId>jakarta.activation-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
+11
-10
@@ -33,7 +33,6 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
@@ -43,29 +42,31 @@
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld</groupId>
|
||||
<artifactId>weld-core-impl</artifactId>
|
||||
<scope>provided</scope>
|
||||
<version>${weld.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.se</groupId>
|
||||
<artifactId>weld-se-core</artifactId>
|
||||
<version>${weld.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<!-- org.springframework.mock.jndi.SimpleNamingContextBuilder removed from newer version -->
|
||||
<version>4.3.0.RELEASE</version>
|
||||
<groupId>com.github.h-thurow</groupId>
|
||||
<artifactId>simple-jndi</artifactId>
|
||||
<version>0.25.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.inject</groupId>
|
||||
<artifactId>jakarta.inject-api</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
|
||||
@@ -21,11 +21,14 @@ package org.apache.struts2.cdi;
|
||||
import org.jboss.weld.bootstrap.api.helpers.RegistrySingletonProvider;
|
||||
import org.jboss.weld.environment.se.Weld;
|
||||
import org.jboss.weld.environment.se.WeldContainer;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.jndi.SimpleNamingContextBuilder;
|
||||
|
||||
import jakarta.enterprise.inject.spi.InjectionTarget;
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
@@ -33,14 +36,28 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class CdiObjectFactoryTest {
|
||||
|
||||
private static final String SHARED_JNDI = "org.osjava.sj.jndi.shared";
|
||||
private static InitialContext context;
|
||||
private static WeldContainer container;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws Exception {
|
||||
Weld weld = new Weld().containerId(RegistrySingletonProvider.STATIC_INSTANCE);
|
||||
WeldContainer container = weld.initialize();
|
||||
container = new Weld().containerId(RegistrySingletonProvider.STATIC_INSTANCE).initialize();
|
||||
|
||||
SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder();
|
||||
builder.activate();
|
||||
builder.bind(CdiObjectFactory.CDI_JNDIKEY_BEANMANAGER_COMP, container.getBeanManager());
|
||||
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.osjava.sj.SimpleContextFactory");
|
||||
System.setProperty(SHARED_JNDI, "true");
|
||||
context = new InitialContext();
|
||||
context.bind(CdiObjectFactory.CDI_JNDIKEY_BEANMANAGER_COMP, container.getBeanManager());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDown() throws NamingException {
|
||||
container.shutdown();
|
||||
|
||||
context.unbind(CdiObjectFactory.CDI_JNDIKEY_BEANMANAGER_COMP);
|
||||
context.close();
|
||||
System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);
|
||||
System.clearProperty(SHARED_JNDI);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -50,16 +67,16 @@ public class CdiObjectFactoryTest {
|
||||
|
||||
@Test
|
||||
public void testGetBean() throws Exception {
|
||||
final CdiObjectFactory cdiObjectFactory = new CdiObjectFactory();
|
||||
FooConsumer fooConsumer = (FooConsumer) cdiObjectFactory.buildBean(FooConsumer.class.getCanonicalName(), null, false);
|
||||
var cdiObjectFactory = new CdiObjectFactory();
|
||||
var fooConsumer = (FooConsumer) cdiObjectFactory.buildBean(FooConsumer.class.getCanonicalName(), null, false);
|
||||
assertNotNull(fooConsumer);
|
||||
assertNotNull(fooConsumer.fooService);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetInjectionTarget() {
|
||||
final CdiObjectFactory cdiObjectFactory = new CdiObjectFactory();
|
||||
final InjectionTarget<?> injectionTarget = cdiObjectFactory.getInjectionTarget(FooConsumer.class);
|
||||
var cdiObjectFactory = new CdiObjectFactory();
|
||||
InjectionTarget<?> injectionTarget = cdiObjectFactory.getInjectionTarget(FooConsumer.class);
|
||||
assertNotNull(injectionTarget);
|
||||
assertTrue(cdiObjectFactory.injectionTargetCache.containsKey(FooConsumer.class));
|
||||
assertSame(cdiObjectFactory.getInjectionTarget(FooConsumer.class), injectionTarget);
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
+35
-83
@@ -20,11 +20,9 @@ package org.apache.struts2.dispatcher;
|
||||
|
||||
import org.apache.struts2.ActionContext;
|
||||
import org.apache.struts2.ActionInvocation;
|
||||
import org.apache.struts2.ActionProxy;
|
||||
import org.apache.struts2.util.ValueStack;
|
||||
import org.apache.struts2.ServletActionContext;
|
||||
import org.apache.struts2.junit.StrutsTestCase;
|
||||
import org.easymock.EasyMock;
|
||||
import org.apache.struts2.util.ValueStack;
|
||||
import org.jfree.chart.ChartFactory;
|
||||
import org.jfree.chart.JFreeChart;
|
||||
import org.jfree.data.general.DefaultPieDataset;
|
||||
@@ -34,42 +32,53 @@ import jakarta.servlet.WriteListener;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.junit.Assert.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ChartResultTest extends StrutsTestCase {
|
||||
|
||||
private ChartResult result;
|
||||
|
||||
private ActionInvocation actionInvocation;
|
||||
private JFreeChart mockChart;
|
||||
private MockServletOutputStream os;
|
||||
private ValueStack stack;
|
||||
private ActionProxy mockActionProxy;
|
||||
private HttpServletResponse responseMock;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
result = new ChartResult();
|
||||
|
||||
var data = new DefaultPieDataset<String>();
|
||||
data.setValue("Java", Double.valueOf(43.2));
|
||||
data.setValue("Visual Basic", Double.valueOf(0.0));
|
||||
data.setValue("C/C++", Double.valueOf(17.5));
|
||||
mockChart = ChartFactory.createPieChart("Pie Chart", data, true, true, false);
|
||||
|
||||
actionInvocation = mock(ActionInvocation.class);
|
||||
when(actionInvocation.getStack()).thenReturn(ActionContext.getContext().getValueStack());
|
||||
|
||||
os = new MockServletOutputStream();
|
||||
responseMock = mock(HttpServletResponse.class);
|
||||
when(responseMock.getOutputStream()).thenReturn(os);
|
||||
|
||||
ServletActionContext.setResponse(responseMock);
|
||||
}
|
||||
|
||||
public void testChart() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
|
||||
ChartResult result = new ChartResult();
|
||||
|
||||
result.setChart(mockChart);
|
||||
|
||||
result.setHeight("10");
|
||||
result.setWidth("10");
|
||||
result.execute(actionInvocation);
|
||||
|
||||
EasyMock.verify(responseMock);
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
public void testContentTypePng() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
responseMock.setContentType("image/png");
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
ChartResult result = new ChartResult();
|
||||
|
||||
result.setChart(mockChart);
|
||||
|
||||
result.setHeight("10");
|
||||
@@ -77,16 +86,11 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
result.setType("png");
|
||||
result.execute(actionInvocation);
|
||||
|
||||
EasyMock.verify(responseMock);
|
||||
verify(responseMock).setContentType("image/png");
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
public void testContentTypeJpg() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
responseMock.setContentType("image/jpg");
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
ChartResult result = new ChartResult();
|
||||
|
||||
result.setChart(mockChart);
|
||||
|
||||
result.setHeight("10");
|
||||
@@ -94,36 +98,19 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
result.setType("jpg");
|
||||
result.execute(actionInvocation);
|
||||
|
||||
EasyMock.verify(responseMock);
|
||||
verify(responseMock).setContentType("image/jpg");
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
|
||||
public void testChartNotSet() {
|
||||
ChartResult result = new ChartResult();
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
|
||||
// expect exception if chart not set.
|
||||
result.setChart(null);
|
||||
|
||||
try {
|
||||
result.execute(actionInvocation);
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
}
|
||||
assertThrows(NullPointerException.class, () -> result.execute(actionInvocation));
|
||||
|
||||
EasyMock.verify(responseMock);
|
||||
assertFalse(os.isWritten());
|
||||
}
|
||||
|
||||
|
||||
public void testChartWithOGNLProperties() throws Exception {
|
||||
EasyMock.expect(responseMock.getOutputStream()).andReturn(os);
|
||||
EasyMock.replay(responseMock, mockActionProxy, actionInvocation);
|
||||
|
||||
|
||||
ChartResult result = new ChartResult();
|
||||
|
||||
result.setChart(mockChart);
|
||||
|
||||
result.setHeight("${myHeight}");
|
||||
@@ -135,50 +122,14 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
|
||||
result.execute(actionInvocation);
|
||||
|
||||
EasyMock.verify(responseMock);
|
||||
assertEquals(result.getHeight(), stack.findValue("myHeight").toString());
|
||||
assertEquals(result.getWidth(), stack.findValue("myWidth").toString());
|
||||
assertEquals("250", result.getHeight().toString());
|
||||
assertEquals("150", result.getWidth().toString());
|
||||
assertEquals("250", result.getHeight());
|
||||
assertEquals("150", result.getWidth());
|
||||
assertTrue(os.isWritten());
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
DefaultPieDataset data = new DefaultPieDataset();
|
||||
data.setValue("Java", new Double(43.2));
|
||||
data.setValue("Visual Basic", new Double(0.0));
|
||||
data.setValue("C/C++", new Double(17.5));
|
||||
mockChart = ChartFactory.createPieChart("Pie Chart", data, true, true, false);
|
||||
|
||||
|
||||
stack = ActionContext.getContext().getValueStack();
|
||||
|
||||
mockActionProxy = EasyMock.createNiceMock(ActionProxy.class);
|
||||
EasyMock.expect(mockActionProxy.getNamespace()).andReturn("/html");
|
||||
|
||||
actionInvocation = EasyMock.createMock(ActionInvocation.class);
|
||||
|
||||
EasyMock.expect(actionInvocation.getStack()).andReturn(stack).anyTimes();
|
||||
|
||||
|
||||
os = new MockServletOutputStream();
|
||||
responseMock = EasyMock.createNiceMock(HttpServletResponse.class);
|
||||
|
||||
ServletActionContext.setResponse((HttpServletResponse) responseMock);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
actionInvocation = null;
|
||||
os = null;
|
||||
responseMock = null;
|
||||
stack = null;
|
||||
mockActionProxy = null;
|
||||
}
|
||||
|
||||
|
||||
private class MockServletOutputStream extends ServletOutputStream {
|
||||
private static class MockServletOutputStream extends ServletOutputStream {
|
||||
// very simple check that outputStream was written to.
|
||||
private boolean written = false;
|
||||
|
||||
@@ -189,6 +140,7 @@ public class ChartResultTest extends StrutsTestCase {
|
||||
return written;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(int arg0) throws IOException {
|
||||
written = true;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.juneau</groupId>
|
||||
<artifactId>juneau-marshall</artifactId>
|
||||
<version>8.1.3</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
|
||||
@@ -67,11 +67,17 @@
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-digester3</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jakarta.el</groupId>
|
||||
<artifactId>jakarta.el-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>jakarta.el</artifactId>
|
||||
<optional>true</optional>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
@@ -82,7 +88,6 @@
|
||||
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
|
||||
@@ -103,11 +108,6 @@
|
||||
<artifactId>log4j-jcl</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
|
||||
@@ -50,17 +50,16 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mockobjects</groupId>
|
||||
<artifactId>mockobjects-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-junit-plugin</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
+25
-26
@@ -18,41 +18,42 @@
|
||||
*/
|
||||
package org.apache.struts2.views.velocity.template;
|
||||
|
||||
import com.mockobjects.dynamic.C;
|
||||
import com.mockobjects.dynamic.Mock;
|
||||
import org.apache.struts2.XWorkTestCase;
|
||||
import org.apache.struts2.inject.Container;
|
||||
import org.apache.struts2.components.template.FreemarkerTemplateEngine;
|
||||
import org.apache.struts2.components.template.JspTemplateEngine;
|
||||
import org.apache.struts2.components.template.Template;
|
||||
import org.apache.struts2.components.template.TemplateEngine;
|
||||
import org.apache.struts2.components.template.TemplateEngineManager;
|
||||
import org.apache.struts2.inject.Container;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class VelocityTemplateEngineTest extends XWorkTestCase {
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class VelocityTemplateEngineTest {
|
||||
|
||||
private TemplateEngineManager mgr;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
mgr = new TemplateEngineManager();
|
||||
Mock mockContainer = new Mock(Container.class);
|
||||
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("jsp")), new JspTemplateEngine());
|
||||
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("vm")), new VelocityTemplateEngine());
|
||||
mockContainer.matchAndReturn("getInstance", C.args(C.eq(TemplateEngine.class), C.eq("ftl")), new FreemarkerTemplateEngine());
|
||||
mockContainer.matchAndReturn("getInstanceNames", C.args(C.eq(TemplateEngine.class)), new HashSet<String>() {{
|
||||
add("jsp");
|
||||
add("vm");
|
||||
add("ftl");
|
||||
}});
|
||||
|
||||
mgr.setContainer((Container) mockContainer.proxy());
|
||||
var mockContainer = mock(Container.class);
|
||||
when(mockContainer.getInstance(TemplateEngine.class, "jsp")).thenReturn(new JspTemplateEngine());
|
||||
when(mockContainer.getInstance(TemplateEngine.class, "vm")).thenReturn(new VelocityTemplateEngine());
|
||||
when(mockContainer.getInstance(TemplateEngine.class, "ftl")).thenReturn(new FreemarkerTemplateEngine());
|
||||
when(mockContainer.getInstanceNames(TemplateEngine.class)).thenReturn(Set.of("jsp", "vm", "ftl"));
|
||||
|
||||
mgr.setContainer(mockContainer);
|
||||
mgr.setDefaultTemplateType("jsp");
|
||||
}
|
||||
|
||||
public void testTemplateTypeFromTemplateNameAndDefaults() {
|
||||
@Test
|
||||
public void templateTypeFromTemplateNameAndDefaults() {
|
||||
|
||||
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
|
||||
assertTrue(engine instanceof JspTemplateEngine);
|
||||
@@ -60,7 +61,8 @@ public class VelocityTemplateEngineTest extends XWorkTestCase {
|
||||
assertTrue(engine instanceof VelocityTemplateEngine);
|
||||
}
|
||||
|
||||
public void testTemplateTypeOverrides() {
|
||||
@Test
|
||||
public void templateTypeOverrides() {
|
||||
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), "ftl");
|
||||
assertTrue(engine instanceof FreemarkerTemplateEngine);
|
||||
engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo.vm"), "ftl");
|
||||
@@ -69,7 +71,8 @@ public class VelocityTemplateEngineTest extends XWorkTestCase {
|
||||
assertTrue(engine instanceof FreemarkerTemplateEngine);
|
||||
}
|
||||
|
||||
public void testTemplateTypeUsesDefaultWhenNotSetInConfiguration() {
|
||||
@Test
|
||||
public void templateTypeUsesDefaultWhenNotSetInConfiguration() {
|
||||
mgr.setDefaultTemplateType(null);
|
||||
TemplateEngine engine = mgr.getTemplateEngine(new Template("/template", "simple", "foo"), null);
|
||||
Template template = new Template("/template", "simple", "foo." + TemplateEngineManager.DEFAULT_TEMPLATE_TYPE);
|
||||
@@ -77,8 +80,4 @@ public class VelocityTemplateEngineTest extends XWorkTestCase {
|
||||
assertEquals(engine.getClass(), defaultTemplateEngine.getClass());
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,24 +106,23 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.build.outputTimestamp>2025-02-17T09:41:25Z</project.build.outputTimestamp>
|
||||
<maven.compiler.release>17</maven.compiler.release>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
||||
<!-- dependency versions in alphanumeric order -->
|
||||
<asm.version>9.7.1</asm.version>
|
||||
<byte-buddy.version>1.16.1</byte-buddy.version>
|
||||
<byte-buddy.version>1.17.1</byte-buddy.version>
|
||||
<freemarker.version>2.3.34</freemarker.version>
|
||||
<hibernate-validator.version>8.0.1.Final</hibernate-validator.version>
|
||||
<hibernate-validator.version>8.0.2.Final</hibernate-validator.version>
|
||||
<jackson.version>2.18.2</jackson.version>
|
||||
<jakarta-ee.version>10.0.0</jakarta-ee.version>
|
||||
<jaxb-impl.version>4.0.5</jaxb-impl.version>
|
||||
<log4j2.version>2.24.3</log4j2.version>
|
||||
<maven-surefire-plugin.version>3.5.2</maven-surefire-plugin.version>
|
||||
<mockito.version>5.8.0</mockito.version>
|
||||
<mockito.version>5.15.2</mockito.version>
|
||||
<ognl.version>3.3.5</ognl.version>
|
||||
<slf4j.version>2.0.16</slf4j.version>
|
||||
<spring.platformVersion>6.0.13</spring.platformVersion>
|
||||
<tiles.version>3.0.8</tiles.version>
|
||||
<tiles-request.version>1.0.7</tiles-request.version>
|
||||
<spring.version>6.2.3</spring.version>
|
||||
<velocity-tools.version>3.1</velocity-tools.version>
|
||||
<weld.version>5.1.2.Final</weld.version>
|
||||
|
||||
<!-- Site generation -->
|
||||
<fluido-skin.version>1.9</fluido-skin.version>
|
||||
@@ -168,36 +167,6 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>jdk17</id>
|
||||
<activation>
|
||||
<jdk>[17,)</jdk>
|
||||
</activation>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>
|
||||
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||
--add-opens java.base/java.util=ALL-UNNAMED
|
||||
@{argLine}
|
||||
</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>coverage</id>
|
||||
<build>
|
||||
@@ -253,7 +222,11 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
<argLine>@{argLine}</argLine>
|
||||
<argLine>
|
||||
--add-opens java.base/java.lang=ALL-UNNAMED
|
||||
--add-opens java.base/java.util=ALL-UNNAMED
|
||||
@{argLine}
|
||||
</argLine>
|
||||
<includes>
|
||||
<include>**/*Test.java</include>
|
||||
</includes>
|
||||
@@ -459,6 +432,7 @@
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
<configuration>
|
||||
<doclint>none</doclint>
|
||||
<failOnError>false</failOnError>
|
||||
</configuration>
|
||||
</plugin>
|
||||
@@ -587,7 +561,6 @@
|
||||
<artifactId>struts2-velocity-plugin</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-xslt-plugin</artifactId>
|
||||
@@ -612,25 +585,22 @@
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>2.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity.tools</groupId>
|
||||
<artifactId>velocity-tools-generic</artifactId>
|
||||
<version>${velocity-tools.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-velocity-tools-view-jakarta</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-velocity-tools-jsp-jakarta</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity.tools</groupId>
|
||||
<artifactId>velocity-tools-generic</artifactId>
|
||||
<version>${velocity-tools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>ognl</groupId>
|
||||
<artifactId>ognl</artifactId>
|
||||
@@ -648,65 +618,25 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-digester3</artifactId>
|
||||
<version>3.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<groupId>jakarta.platform</groupId>
|
||||
<artifactId>jakarta.jakartaee-bom</artifactId>
|
||||
<version>${jakarta-ee.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>5.4.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<scope>provided</scope>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-bom</artifactId>
|
||||
<version>${jaxb-impl.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.glassfish</groupId>
|
||||
<artifactId>jakarta.el</artifactId>
|
||||
<version>5.0.0-M1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.el</groupId>
|
||||
<artifactId>jakarta.el-api</artifactId>
|
||||
<version>5.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet.jsp</groupId>
|
||||
<artifactId>jakarta.servlet.jsp-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Commons -->
|
||||
@@ -756,47 +686,52 @@
|
||||
<artifactId>commons-validator</artifactId>
|
||||
<version>1.9.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.27.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-digester3</artifactId>
|
||||
<version>3.2</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>asm</groupId>
|
||||
<artifactId>asm</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Mocks for unit testing (by Spring) -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
<artifactId>spring-framework-bom</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>5.4.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>${spring.platformVersion}</version>
|
||||
<groupId>org.awaitility</groupId>
|
||||
<artifactId>awaitility</artifactId>
|
||||
<version>4.2.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mockobjects</groupId>
|
||||
@@ -810,21 +745,18 @@
|
||||
<version>4.9.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jmock</groupId>
|
||||
<artifactId>jmock</artifactId>
|
||||
<version>1.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.26.3</version>
|
||||
<version>3.27.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
@@ -843,6 +775,12 @@
|
||||
<version>${byte-buddy.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.11.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -857,34 +795,10 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<artifactId>log4j-bom</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-jcl</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-slf4j-impl</artifactId>
|
||||
<version>${log4j2.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.27.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.5.1</version><!-- the latest version supporting Java 1.8 -->
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -900,52 +814,12 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-core</artifactId>
|
||||
<groupId>com.fasterxml.jackson</groupId>
|
||||
<artifactId>jackson-bom</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.juneau</groupId>
|
||||
<artifactId>juneau-marshall</artifactId>
|
||||
<version>8.1.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- CDI & Weld -->
|
||||
<dependency>
|
||||
<groupId>jakarta.enterprise</groupId>
|
||||
<artifactId>jakarta.enterprise.cdi-api</artifactId>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld</groupId>
|
||||
<artifactId>weld-core-impl</artifactId>
|
||||
<version>5.1.2.Final</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>jakarta.annotation</groupId>
|
||||
<artifactId>jakarta.annotation-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.weld.se</groupId>
|
||||
<artifactId>weld-se-core</artifactId>
|
||||
<version>5.1.2.Final</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user