Reworking cdi-webapp-it to also use new cdi module

This commit is contained in:
Joakim Erdfelt 2014-09-26 17:16:35 -07:00
parent c3670d01e1
commit bf7637a2df
8 changed files with 81 additions and 12 deletions

View File

@ -82,7 +82,6 @@ import org.eclipse.jetty.start.config.CommandLineConfigSource;
public class Main
{
private static final int EXIT_USAGE = 1;
private static BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
public static String join(Collection<?> objs, String delim)
{
@ -435,13 +434,28 @@ public class Main
System.err.printf(" + has not been audited for compliance with its license%n");
System.err.printf("%n");
for (String l : module.getLicense())
{
System.err.printf(" %s%n",l);
}
System.err.printf("%nProceed (y/N)? ");
String line = input.readLine();
if (args.isApproveAllLicenses())
{
System.err.println("All licenses approved via command line");
}
else
{
try (BufferedReader input = new BufferedReader(new InputStreamReader(System.in)))
{
System.err.printf("%nProceed (y/N)? ");
String line = input.readLine();
if (line==null || line.length()==0 || !line.toLowerCase().startsWith("y"))
System.exit(1);
if (line == null || line.length() == 0 || !line.toLowerCase().startsWith("y"))
{
System.err.printf("Exiting: license not acknowledged%n");
System.exit(1);
}
}
}
}

View File

@ -78,7 +78,7 @@ public class StartArgs
private Map<String, String> propertySource = new HashMap<>();
/** List of all active [files] sections from enabled modules */
private List<FileArg> files = new ArrayList<>();
/** List of all active [lib] sectinos from enabled modules */
/** List of all active [lib] sections from enabled modules */
private Classpath classpath;
/** List of all active [xml] sections from enabled modules */
private List<Path> xmls = new ArrayList<>();
@ -122,6 +122,7 @@ public class StartArgs
private boolean dryRun = false;
private boolean exec = false;
private boolean approveAllLicenses = false;
public StartArgs()
{
@ -583,6 +584,11 @@ public class StartArgs
return false;
}
public boolean isApproveAllLicenses()
{
return approveAllLicenses;
}
public boolean isDownload()
{
return download;
@ -748,6 +754,13 @@ public class StartArgs
return;
}
// Enable forked execution of Jetty server
if ("--approve-all-licenses".equals(arg))
{
approveAllLicenses = true;
return;
}
// Arbitrary Libraries
if (arg.startsWith("--lib="))
{

View File

@ -135,7 +135,7 @@
<arg file="${jetty.base}"/>
</exec>
<echo>Integration Test : Start Jetty</echo>
<echo>Integration Test : Starting Jetty ...</echo>
<exec executable="${run.command}"
dir="${scripts-dir}"
spawn="true">

View File

@ -26,6 +26,9 @@ import java.net.URI;
import org.eclipse.jetty.toolchain.test.SimpleRequest;
import org.junit.Test;
/**
* Basic tests for a simple @WebServlet with no CDI
*/
public class HelloIT
{
@Test
@ -33,6 +36,6 @@ public class HelloIT
{
URI serverURI = new URI("http://localhost:58080/cdi-webapp/");
SimpleRequest req = new SimpleRequest(serverURI);
assertThat( req.getString("hello"), is("hi"));
assertThat(req.getString("hello"),is("Hello World"));
}
}

View File

@ -0,0 +1,37 @@
//
// ========================================================================
// Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
// ------------------------------------------------------------------------
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the Eclipse Public License v1.0
// and Apache License v2.0 which accompanies this distribution.
//
// The Eclipse Public License is available at
// http://www.eclipse.org/legal/epl-v10.html
//
// The Apache License v2.0 is available at
// http://www.opensource.org/licenses/apache2.0.php
//
// You may elect to redistribute this code under either of these licenses.
// ========================================================================
//
package org.eclipse.jetty.tests;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import java.net.URI;
import org.eclipse.jetty.toolchain.test.SimpleRequest;
import org.junit.Test;
public class ServerInfoIT
{
@Test
public void testGET() throws Exception {
URI serverURI = new URI("http://localhost:58080/cdi-webapp/");
SimpleRequest req = new SimpleRequest(serverURI);
assertThat(req.getString("serverinfo"),is("Hello World"));
}
}

View File

@ -9,10 +9,11 @@ echo \${jetty.home} : $JETTY_HOME
echo \${jetty.base} : $JETTY_BASE
cd "$JETTY_BASE"
"$JAVA_HOME/bin/java" -jar "$JETTY_HOME/start.jar" \
--add-to-start=deploy,http,annotations
--approve-all-licenses \
--add-to-start=deploy,http,annotations,cdi,logging
"$JAVA_HOME/bin/java" -jar "$JETTY_HOME/start.jar" \
--version

View File

@ -9,6 +9,7 @@ echo \${jetty.home} : $JETTY_HOME
echo \${jetty.base} : $JETTY_BASE
cd "$JETTY_BASE"
"$JAVA_HOME/bin/java" -jar "$JETTY_HOME/start.jar" \
jetty.port=58080 \
STOP.PORT=58181 STOP.KEY=it

View File

@ -29,7 +29,7 @@
<url>http://www.eclipse.org/jetty</url>
<modules>
<module>cdi-webapp</module>
<module>cdi-webapp-it</module>
<module>cdi-client</module>
<module>cdi-tests</module>
</modules>
</project>