diff --git a/assembly/src/main/assembly/min-lib.xml b/assembly/src/main/assembly/min-lib.xml index 3e6e4a176..3cae96356 100644 --- a/assembly/src/main/assembly/min-lib.xml +++ b/assembly/src/main/assembly/min-lib.xml @@ -36,6 +36,7 @@ org.apache.struts:struts2-core org.freemarker:freemarker org.apache.commons:commons-lang3 + org.apache.commons:commons-text org.apache.logging.log4j:log4j-api ognl:ognl commons-fileupload:commons-fileupload diff --git a/plugins/cdi/src/test/java/org/apache/struts2/cdi/CdiObjectFactoryTest.java b/plugins/cdi/src/test/java/org/apache/struts2/cdi/CdiObjectFactoryTest.java index 7bee7629a..bae580cd4 100644 --- a/plugins/cdi/src/test/java/org/apache/struts2/cdi/CdiObjectFactoryTest.java +++ b/plugins/cdi/src/test/java/org/apache/struts2/cdi/CdiObjectFactoryTest.java @@ -18,33 +18,33 @@ */ package org.apache.struts2.cdi; -import org.jboss.weld.environment.se.StartMain; -import static org.junit.Assert.*; - +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.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.springframework.mock.jndi.SimpleNamingContextBuilder; import javax.enterprise.inject.spi.InjectionTarget; -/** - * CdiObjectFactoryTest. - */ +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + public class CdiObjectFactoryTest { - @Before - public void setUp() throws Exception { + @BeforeClass + public static void setup() throws Exception { + Weld weld = new Weld().containerId(RegistrySingletonProvider.STATIC_INSTANCE); + WeldContainer container = weld.initialize(); + SimpleNamingContextBuilder builder = new SimpleNamingContextBuilder(); builder.activate(); - - StartMain sm = new StartMain(new String[0]); - WeldContainer weldContainer = sm.go(); - builder.bind(CdiObjectFactory.CDI_JNDIKEY_BEANMANAGER_COMP, weldContainer.getBeanManager()); + builder.bind(CdiObjectFactory.CDI_JNDIKEY_BEANMANAGER_COMP, container.getBeanManager()); } @Test - public void testFindBeanManager() throws Exception { + public void testFindBeanManager() { assertNotNull(new CdiObjectFactory().findBeanManager()); } @@ -56,7 +56,8 @@ public class CdiObjectFactoryTest { assertNotNull(fooConsumer.fooService); } - @Test public void testGetInjectionTarget() throws Exception { + @Test + public void testGetInjectionTarget() { final CdiObjectFactory cdiObjectFactory = new CdiObjectFactory(); final InjectionTarget injectionTarget = cdiObjectFactory.getInjectionTarget(FooConsumer.class); assertNotNull(injectionTarget); diff --git a/pom.xml b/pom.xml index f36e4b92c..fe0e45379 100644 --- a/pom.xml +++ b/pom.xml @@ -1202,13 +1202,13 @@ org.jboss.weld weld-core - 2.2.16.SP1 + 2.4.8.Final org.jboss.weld.se weld-se - 2.2.16.SP1 + 2.4.8.Final