rename classes to avoid using Servlet in the name as it is confusing #2370 (#2371)

Signed-off-by: olivier lamy <olamy@webtide.com>
This commit is contained in:
Olivier Lamy 2018-03-23 13:03:15 +10:00 committed by GitHub
parent d726fe5c03
commit 682ac94373
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 214 additions and 200 deletions

View File

@ -179,6 +179,13 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-home</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<type>zip</type>
</dependency>
</dependencies>
<reporting>
<plugins>

View File

@ -29,11 +29,11 @@ import org.junit.Test;
/**
*
*/
public class TestHelloServlet
public class TestGetContent
{
@Test
public void hello_servlet()
public void get_ping_response()
throws Exception
{
int port = getPort();

View File

@ -29,10 +29,11 @@ import org.junit.Test;
/**
*
*/
public class TestHelloServlet
public class TestGetContent
{
@Test
public void hello_servlet()
public void get_ping_response()
throws Exception
{

View File

@ -16,8 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.its.jetty_run_war_mojo_it;
package org.eclipse.jetty.its.jetty_run_forked_mojo_it;
import java.io.File;
import java.io.FileReader;
@ -30,12 +29,14 @@ import org.junit.Test;
/**
*
*/
public class TestHelloServlet
public class TestGetContent
{
@Test
public void hello_servlet()
public void get_ping_response()
throws Exception
{
int port = getPort();
Assert.assertTrue(port > 0);
HttpClient httpClient = new HttpClient();
@ -57,6 +58,7 @@ public class TestHelloServlet
}
}
public int getPort()
throws Exception
{
@ -89,5 +91,4 @@ public class TestHelloServlet
}
return port;
}
}

View File

@ -1,91 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2018 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.its.jetty_run_mojo_it;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import org.eclipse.jetty.client.HttpClient;
import org.junit.Assert;
import org.junit.Test;
/**
*
*/
public class TestHelloServlet
{
@Test
public void hello_servlet()
throws Exception
{
int port = getPort();
HttpClient httpClient = new HttpClient();
try
{
httpClient.start();
String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString();
Assert.assertEquals( "hello beer", response.trim() );
response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString();
Assert.assertEquals( "pong beer", response.trim() );
}
finally
{
httpClient.stop();
}
}
public int getPort()
throws Exception
{
int attempts = 20;
int port = -1;
String s = System.getProperty("jetty.port.file");
Assert.assertNotNull(s);
File f = new File(s);
while (true)
{
if (f.exists())
{
try (FileReader r = new FileReader(f);
LineNumberReader lnr = new LineNumberReader(r);
)
{
s = lnr.readLine();
Assert.assertNotNull(s);
port = Integer.parseInt(s.trim());
}
break;
}
else
{
if (--attempts < 0)
break;
else
Thread.currentThread().sleep(100);
}
}
return port;
}
}

View File

@ -16,8 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.its.jetty_run_war_exploded_mojo_it;
package org.eclipse.jetty.its.jetty_run_forked_mojo_it;
import java.io.File;
import java.io.FileReader;
@ -30,12 +29,14 @@ import org.junit.Test;
/**
*
*/
public class TestHelloServlet
public class TestGetContent
{
@Test
public void hello_servlet()
public void get_ping_response()
throws Exception
{
int port = getPort();
Assert.assertTrue(port > 0);
HttpClient httpClient = new HttpClient();
@ -57,6 +58,7 @@ public class TestHelloServlet
}
}
public int getPort()
throws Exception
{
@ -89,5 +91,4 @@ public class TestHelloServlet
}
return port;
}
}

View File

@ -0,0 +1,94 @@
//
// ========================================================================
// Copyright (c) 1995-2018 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.its.jetty_run_forked_mojo_it;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import org.eclipse.jetty.client.HttpClient;
import org.junit.Assert;
import org.junit.Test;
/**
*
*/
public class TestGetContent
{
@Test
public void get_ping_response()
throws Exception
{
int port = getPort();
Assert.assertTrue(port > 0);
HttpClient httpClient = new HttpClient();
try
{
httpClient.start();
String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString();
Assert.assertEquals( "hello beer", response.trim() );
response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString();
Assert.assertEquals( "pong beer", response.trim() );
}
finally
{
httpClient.stop();
}
}
public int getPort()
throws Exception
{
int attempts = 20;
int port = -1;
String s = System.getProperty("jetty.port.file");
Assert.assertNotNull(s);
File f = new File(s);
while (true)
{
if (f.exists())
{
try (FileReader r = new FileReader(f);
LineNumberReader lnr = new LineNumberReader(r);
)
{
s = lnr.readLine();
Assert.assertNotNull(s);
port = Integer.parseInt(s.trim());
}
break;
}
else
{
if (--attempts < 0)
break;
else
Thread.currentThread().sleep(100);
}
}
return port;
}
}

View File

@ -0,0 +1,94 @@
//
// ========================================================================
// Copyright (c) 1995-2018 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.its.jetty_run_forked_mojo_it;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import org.eclipse.jetty.client.HttpClient;
import org.junit.Assert;
import org.junit.Test;
/**
*
*/
public class TestGetContent
{
@Test
public void get_ping_response()
throws Exception
{
int port = getPort();
Assert.assertTrue(port > 0);
HttpClient httpClient = new HttpClient();
try
{
httpClient.start();
String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString();
Assert.assertEquals( "hello beer", response.trim() );
response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString();
Assert.assertEquals( "pong beer", response.trim() );
}
finally
{
httpClient.stop();
}
}
public int getPort()
throws Exception
{
int attempts = 20;
int port = -1;
String s = System.getProperty("jetty.port.file");
Assert.assertNotNull(s);
File f = new File(s);
while (true)
{
if (f.exists())
{
try (FileReader r = new FileReader(f);
LineNumberReader lnr = new LineNumberReader(r);
)
{
s = lnr.readLine();
Assert.assertNotNull(s);
port = Integer.parseInt(s.trim());
}
break;
}
else
{
if (--attempts < 0)
break;
else
Thread.currentThread().sleep(100);
}
}
return port;
}
}

View File

@ -1,93 +0,0 @@
//
// ========================================================================
// Copyright (c) 1995-2018 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.its.jetty_start_mojo_it;
import java.io.File;
import java.io.FileReader;
import java.io.LineNumberReader;
import org.eclipse.jetty.client.HttpClient;
import org.junit.Assert;
import org.junit.Test;
/**
*
*/
public class TestHelloServlet
{
@Test
public void hello_servlet()
throws Exception
{
int port = getPort();
Assert.assertTrue(port > 0);
HttpClient httpClient = new HttpClient();
try
{
httpClient.start();
String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString();
Assert.assertEquals( "hello beer", response.trim() );
response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString();
Assert.assertEquals( "pong beer", response.trim() );
}
finally
{
httpClient.stop();
}
}
public int getPort()
throws Exception
{
int attempts = 20;
int port = -1;
String s = System.getProperty("jetty.port.file");
Assert.assertNotNull(s);
File f = new File(s);
while (true)
{
if (f.exists())
{
try (FileReader r = new FileReader(f);
LineNumberReader lnr = new LineNumberReader(r);
)
{
s = lnr.readLine();
Assert.assertNotNull(s);
port = Integer.parseInt(s.trim());
}
break;
}
else
{
if (--attempts < 0)
break;
else
Thread.currentThread().sleep(100);
}
}
return port;
}
}