Issue #3731 - updating `cdi2` module expectations

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-06-06 10:02:32 -05:00
parent 4f82a23a7a
commit 0d4aa4ea49
2 changed files with 11 additions and 20 deletions

View File

@ -6,6 +6,9 @@ Jetty setup to support Weld/CDI2 with WELD inside the webapp
[depend]
deploy
[lib]
lib/apache-jsp/org.mortbay.jasper.apache-el-*.jar
[xml]
etc/cdi2/jetty-cdi2.xml

View File

@ -19,11 +19,7 @@
package org.eclipse.jetty.tests.distribution;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.http.HttpStatus;
@ -86,22 +82,24 @@ public class CDITests extends AbstractDistributionTest
}
/**
* Tests a WAR file that is expects CDI to be provided by the server.
* Tests a WAR file that is expects CDI to be configured by the server.
*
* <p>
* This means the WAR does NOT have the weld libs in its
* This means the WAR has the weld libs in its
* WEB-INF/lib directory.
* </p>
*
* <p>
* The expectation is that CDI2 is provided by weld
* and the javax.el support comes from JSP
* The expectation is that a context xml deployable file is not
* required when using this `cdi2` module, and the appropriate
* server side libs are made available to allow weld to function.
* (the required server side javax.el support comes from the cdi2 module)
* </p>
*
* @throws Exception
*/
@Test
public void testCDI2_ProvidedByServer() throws Exception
public void testCDI2_ConfiguredByServer() throws Exception
{
String jettyVersion = System.getProperty("jettyVersion");
DistributionTester distribution = DistributionTester.Builder.newInstance()
@ -123,17 +121,7 @@ public class CDITests extends AbstractDistributionTest
assertEquals(0, run1.getExitValue());
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-cdi2-webapp:war:" + jettyVersion);
Path demoDir = distribution.installWarFile(war, "demo");
// Remove weld libs
Path libDir = demoDir.resolve("WEB-INF/lib");
List<Path> weldLibs = Files.list(libDir).filter((path) -> path.getFileName().toString().contains("weld"))
.collect(Collectors.toList());
for (Path weldLib : weldLibs)
{
assertTrue(Files.deleteIfExists(weldLib));
}
distribution.installBaseResource("cdi/demo_context.xml", "webapps/demo.xml");
distribution.installWarFile(war, "demo");
int port = distribution.freePort();
try (DistributionTester.Run run2 = distribution.start("jetty.http.port=" + port))