Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPullSpringTest.java Tue Jul 27 20:46:55 2010
@@ -51,6 +51,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSLoggingAtomPullSpringTest extends AbstractClientServerTestBase {
+ public static final String PORT = SpringServer.PORT;
private static JAXBContext context;
private int fakyLogger;
@@ -87,17 +88,17 @@ public class JAXRSLoggingAtomPullSpringT
@Test
public void testFeed() throws Exception {
- String listing = WebClient.create("http://localhost:9080/services").get(String.class);
- assertTrue(listing, listing.contains("http://localhost:9080/atom/logs"));
- WebClient wc = WebClient.create("http://localhost:9080/resource/root");
+ String listing = WebClient.create("http://localhost:" + PORT + "/services").get(String.class);
+ assertTrue(listing, listing.contains("http://localhost:" + PORT + "/atom/logs"));
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource/root");
wc.path("/log").get();
Thread.sleep(3000);
- checkSimpleFeed(getFeed("http://localhost:9080/atom/logs").getEntries());
- checkSimpleFeed(getFeed("http://localhost:9080/atom/logs").getEntries());
+ checkSimpleFeed(getFeed("http://localhost:" + PORT + "/atom/logs").getEntries());
+ checkSimpleFeed(getFeed("http://localhost:" + PORT + "/atom/logs").getEntries());
List<Entry> entries = new LinkedList<Entry>();
- WebClient wcEntry = WebClient.create("http://localhost:9080/atom/logs",
+ WebClient wcEntry = WebClient.create("http://localhost:" + PORT + "/atom/logs",
Collections.singletonList(new AtomEntryProvider()))
.accept("application/atom+xml;type=entry");
HTTPConduit conduit = WebClient.getConfig(wcEntry).getHttpConduit();
@@ -125,35 +126,38 @@ public class JAXRSLoggingAtomPullSpringT
@Test
public void testPagedFeed() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/resource2/paged");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource2/paged");
wc.path("/log").get();
Thread.sleep(3000);
- verifyPages("http://localhost:9080/atom2/logs", "next", 3, 2, "theNamedLogger");
- verifyPages("http://localhost:9080/atom2/logs/3", "previous", 2, 3, "theNamedLogger");
+ verifyPages("http://localhost:" + PORT + "/atom2/logs", "next", 3, 2, "theNamedLogger");
+ verifyPages("http://localhost:" + PORT + "/atom2/logs/3", "previous", 2, 3, "theNamedLogger");
}
@Test
public void testPagedFeedWithReadWriteStorage() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/resource3/storage");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/resource3/storage");
HTTPConduit conduit = WebClient.getConfig(wc).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
conduit.getClient().setConnectionTimeout(1000000);
wc.path("/log").get();
Thread.sleep(3000);
- verifyStoragePages("http://localhost:9080/atom3/logs", "next", "Resource3", "theStorageLogger");
+ verifyStoragePages("http://localhost:"
+ + PORT + "/atom3/logs", "next", "Resource3", "theStorageLogger");
List<org.apache.cxf.management.web.logging.LogRecord> list = Storage.getRecords();
assertEquals(4, list.size());
- verifyStoragePages("http://localhost:9080/atom3/logs", "next", "Resource3", "theStorageLogger");
- verifyStoragePages("http://localhost:9080/atom3/logs/2", "previous", "Resource3",
+ verifyStoragePages("http://localhost:"
+ + PORT + "/atom3/logs", "next", "Resource3", "theStorageLogger");
+ verifyStoragePages("http://localhost:" + PORT + "/atom3/logs/2", "previous", "Resource3",
"theStorageLogger");
}
@Test
public void testPagedFeedWithReadOnlyStorage() throws Exception {
- verifyStoragePages("http://localhost:9080/atom4/logs", "next", "Resource4", "readOnlyStorageLogger");
- verifyStoragePages("http://localhost:9080/atom4/logs/2", "previous", "Resource4",
+ verifyStoragePages("http://localhost:"
+ + PORT + "/atom4/logs", "next", "Resource4", "readOnlyStorageLogger");
+ verifyStoragePages("http://localhost:" + PORT + "/atom4/logs/2", "previous", "Resource4",
"readOnlyStorageLogger");
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushSpringTest.java Tue Jul 27 20:46:55 2010
@@ -46,6 +46,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSLoggingAtomPushSpringTest extends AbstractClientServerTestBase {
+ public static final String PORT = SpringServer.PORT;
private JAXBContext context;
private int fakyLogger;
@@ -80,7 +81,7 @@ public class JAXRSLoggingAtomPushSpringT
@Test
public void testFeedsWithLogRecordsOneEntry() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/root");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/root");
wc.path("/log").get();
Thread.sleep(3000);
List<Feed> elements = Resource.getElements();
@@ -103,7 +104,7 @@ public class JAXRSLoggingAtomPushSpringT
@Test
public void testFeedsWithBatchLogRecordsOneEntry() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/batch");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/batch");
wc.path("/log").get();
Thread.sleep(3000);
List<Feed> elements = Resource2.getElements();
@@ -125,7 +126,7 @@ public class JAXRSLoggingAtomPushSpringT
@Test
public void testEntriesWithLogRecordsOneEntry() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/entries");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/entries");
wc.path("/log").get();
Thread.sleep(3000);
List<Entry> elements = Resource3.getElements();
@@ -143,7 +144,7 @@ public class JAXRSLoggingAtomPushSpringT
@Test
public void testManyEntries() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/entriesMany");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/entriesMany");
wc.path("/log").get();
Thread.sleep(3000);
List<Entry> elements = Resource4.getElements();
@@ -166,7 +167,7 @@ public class JAXRSLoggingAtomPushSpringT
@Test
public void testFeedsWithLogRecordsExtension() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/extensions");
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/extensions");
wc.path("/log").get();
Thread.sleep(3000);
List<Feed> elements = Resource5.getElements();
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSLoggingAtomPushTest.java Tue Jul 27 20:46:55 2010
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.systest.jaxrs;
+import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Arrays;
import java.util.List;
@@ -36,6 +37,7 @@ import org.apache.abdera.model.Entry;
import org.apache.abdera.model.Feed;
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.helpers.IOUtils;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.ext.atom.AbstractEntryBuilder;
import org.apache.cxf.jaxrs.ext.atom.AbstractFeedBuilder;
@@ -49,6 +51,7 @@ import org.apache.cxf.management.web.log
import org.apache.cxf.management.web.logging.atom.converter.StandardConverter.Output;
import org.apache.cxf.management.web.logging.atom.deliverer.Deliverer;
import org.apache.cxf.management.web.logging.atom.deliverer.WebClientDeliverer;
+import org.apache.cxf.testutil.common.TestUtil;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -58,6 +61,8 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSLoggingAtomPushTest extends Assert {
+ public static final String PORT = TestUtil.getPortNumber(JAXRSLoggingAtomPushTest.class);
+
private static final Logger LOG = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class);
private static Server server;
@@ -70,7 +75,7 @@ public class JAXRSLoggingAtomPushTest ex
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(JAXRSLoggingAtomPushTest.Resource.class);
- sf.setAddress("http://localhost:9080/");
+ sf.setAddress("http://localhost:" + PORT + "/");
sf.setProviders(Arrays.asList(new AtomFeedProvider(), new AtomEntryProvider()));
server = sf.create();
server.start();
@@ -80,7 +85,10 @@ public class JAXRSLoggingAtomPushTest ex
private static void configureLogging(String propFile) throws Exception {
LogManager lm = LogManager.getLogManager();
InputStream ins = JAXRSLoggingAtomPushTest.class.getResourceAsStream(propFile);
- lm.readConfiguration(ins);
+ String s = IOUtils.readStringFromStream(ins);
+ ins.close();
+ s = s.replaceAll("9080", PORT);
+ lm.readConfiguration(new ByteArrayInputStream(s.getBytes("UTF-8")));
}
private static void logSixEvents(Logger log) {
@@ -123,7 +131,7 @@ public class JAXRSLoggingAtomPushTest ex
configureLogging("resources/logging_atompush_disabled.properties");
Logger log = LogUtils.getL7dLogger(JAXRSLoggingAtomPushTest.class, null, "private-log");
Converter c = new StandardConverter(Output.FEED, Multiplicity.ONE, Format.CONTENT);
- Deliverer d = new WebClientDeliverer("http://localhost:9080");
+ Deliverer d = new WebClientDeliverer("http://localhost:" + PORT);
Handler h = new AtomPushHandler(2, c, d);
log.addHandler(h);
log.setLevel(Level.ALL);
@@ -143,7 +151,7 @@ public class JAXRSLoggingAtomPushTest ex
AbstractEntryBuilder<List<org.apache.cxf.management.web.logging.LogRecord>> eb =
createCustomEntryBuilder();
Converter c = new StandardConverter(Output.FEED, Multiplicity.ONE, Format.CONTENT, fb, eb);
- Deliverer d = new WebClientDeliverer("http://localhost:9080");
+ Deliverer d = new WebClientDeliverer("http://localhost:" + PORT);
Handler h = new AtomPushHandler(2, c, d);
log.addHandler(h);
log.setLevel(Level.ALL);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultipartTest.java Tue Jul 27 20:46:55 2010
@@ -59,6 +59,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class JAXRSMultipartTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = MultipartServer.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -68,169 +69,169 @@ public class JAXRSMultipartTest extends
@Test
public void testBookAsRootAttachmentStreamSource() throws Exception {
- String address = "http://localhost:9085/bookstore/books/stream";
+ String address = "http://localhost:" + PORT + "/bookstore/books/stream";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testBookAsRootAttachmentStreamSourceNoContentId() throws Exception {
- String address = "http://localhost:9085/bookstore/books/stream";
+ String address = "http://localhost:" + PORT + "/bookstore/books/stream";
doAddBook(address, "attachmentData3", 200);
}
@Test
public void testBookAsRootAttachmentInputStream() throws Exception {
- String address = "http://localhost:9085/bookstore/books/istream";
+ String address = "http://localhost:" + PORT + "/bookstore/books/istream";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testBookAsMessageContextDataHandler() throws Exception {
- String address = "http://localhost:9085/bookstore/books/mchandlers";
+ String address = "http://localhost:" + PORT + "/bookstore/books/mchandlers";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testBookAsMessageContextAttachments() throws Exception {
- String address = "http://localhost:9085/bookstore/books/attachments";
+ String address = "http://localhost:" + PORT + "/bookstore/books/attachments";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testBookJSONForm() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jsonform";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jsonform";
doAddFormBook(address, "attachmentFormJson", 200);
}
@Test
public void testBookJaxbForm() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbform";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbform";
doAddFormBook(address, "attachmentFormJaxb", 200);
}
@Test
public void testBookJSONJAXBForm() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jsonjaxbform";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jsonjaxbform";
doAddFormBook(address, "attachmentFormJsonJaxb", 200);
}
@Test
public void testBookJSONJAXBFormEncoded() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jsonjaxbform";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jsonjaxbform";
doAddFormBook(address, "attachmentFormJsonJaxbEncoded", 200);
}
@Test
public void testBookJSONFormFiles() throws Exception {
- String address = "http://localhost:9085/bookstore/books/filesform";
+ String address = "http://localhost:" + PORT + "/bookstore/books/filesform";
doAddFormBook(address, "attachmentFormJsonFiles", 200);
}
@Test
public void testBookAsMessageContextAttachment() throws Exception {
- String address = "http://localhost:9085/bookstore/books/attachment";
+ String address = "http://localhost:" + PORT + "/bookstore/books/attachment";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsRootAttachmentJAXB() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxb";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxb";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsDataSource() throws Exception {
- String address = "http://localhost:9085/bookstore/books/dsource";
+ String address = "http://localhost:" + PORT + "/bookstore/books/dsource";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsDataSource2() throws Exception {
- String address = "http://localhost:9085/bookstore/books/dsource2";
+ String address = "http://localhost:" + PORT + "/bookstore/books/dsource2";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsBody() throws Exception {
- String address = "http://localhost:9085/bookstore/books/body";
+ String address = "http://localhost:" + PORT + "/bookstore/books/body";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookFormData() throws Exception {
- String address = "http://localhost:9085/bookstore/books/form";
+ String address = "http://localhost:" + PORT + "/bookstore/books/form";
doAddBook("multipart/form-data", address, "attachmentForm", 200);
}
@Test
public void testAddBookFormParam() throws Exception {
- String address = "http://localhost:9085/bookstore/books/formparam";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formparam";
doAddBook("multipart/form-data", address, "attachmentForm", 200);
}
@Test
public void testAddBookFormBody() throws Exception {
- String address = "http://localhost:9085/bookstore/books/formbody";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formbody";
doAddBook("multipart/form-data", address, "attachmentForm", 200);
}
@Test
public void testAddBookFormBody2() throws Exception {
- String address = "http://localhost:9085/bookstore/books/formbody2";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formbody2";
doAddBook("multipart/form-data", address, "attachmentForm", 200);
}
@Test
public void testAddBookFormParamBean() throws Exception {
- String address = "http://localhost:9085/bookstore/books/formparambean";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formparambean";
doAddBook("multipart/form-data", address, "attachmentForm", 200);
}
@Test
public void testAddBookAsJAXB2() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxb2";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxb2";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsListOfAttachments() throws Exception {
- String address = "http://localhost:9085/bookstore/books/listattachments";
+ String address = "http://localhost:" + PORT + "/bookstore/books/listattachments";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsListOfStreams() throws Exception {
- String address = "http://localhost:9085/bookstore/books/lististreams";
+ String address = "http://localhost:" + PORT + "/bookstore/books/lististreams";
doAddBook(address, "attachmentData", 200);
}
@Test
public void testAddBookAsJAXBJSON() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbjson";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjson";
doAddBook(address, "attachmentData2", 200);
}
@Test
public void testAddBookAsJAXBJSONMixed() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbjson";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjson";
doAddBook("multipart/mixed", address, "attachmentData2", 200);
}
@Test
public void testConsumesMismatch() throws Exception {
- String address = "http://localhost:9085/bookstore/books/mismatch1";
+ String address = "http://localhost:" + PORT + "/bookstore/books/mismatch1";
doAddBook(address, "attachmentData2", 415);
}
@Test
public void testConsumesMismatch2() throws Exception {
- String address = "http://localhost:9085/bookstore/books/mismatch2";
+ String address = "http://localhost:" + PORT + "/bookstore/books/mismatch2";
doAddBook(address, "attachmentData2", 415);
}
@Test
public void testAddBookAsDataHandler() throws Exception {
- String address = "http://localhost:9085/bookstore/books/dhandler";
+ String address = "http://localhost:" + PORT + "/bookstore/books/dhandler";
doAddBook(address, "attachmentData", 200);
}
@@ -238,7 +239,7 @@ public class JAXRSMultipartTest extends
public void testAddBookWebClient() {
InputStream is1 =
getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/add_book.txt");
- String address = "http://localhost:9085/bookstore/books/jaxb";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxb";
WebClient client = WebClient.create(address);
client.type("multipart/related;type=text/xml").accept("text/xml");
Book book = client.post(is1, Book.class);
@@ -247,7 +248,7 @@ public class JAXRSMultipartTest extends
@Test
public void testXopWebClient() throws Exception {
- String address = "http://localhost:9085/bookstore/xop";
+ String address = "http://localhost:" + PORT + "/bookstore/xop";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
bean.setProperties(Collections.singletonMap(org.apache.cxf.message.Message.MTOM_ENABLED,
@@ -257,7 +258,7 @@ public class JAXRSMultipartTest extends
conduit.getClient().setReceiveTimeout(1000000);
conduit.getClient().setConnectionTimeout(1000000);
- client.type("multipart/related").accept("text/plain");
+ client.type("multipart/related").accept("multipart/related");
XopType xop = new XopType();
xop.setName("xopName");
InputStream is =
@@ -275,10 +276,12 @@ public class JAXRSMultipartTest extends
xop.setImage(getImage("/org/apache/cxf/systest/jaxrs/resources/java.jpg"));
}
- String response = client.post(xop, String.class);
+ XopType xop2 = client.post(xop, XopType.class);
-
- assertEquals("xopName" + bookXsd + bookXsd, response);
+ String bookXsdOriginal = IOUtils.readStringFromStream(getClass().getResourceAsStream(
+ "/org/apache/cxf/systest/jaxrs/resources/book.xsd"));
+ String bookXsd2 = IOUtils.readStringFromStream(xop2.getAttachinfo().getInputStream());
+ assertEquals(bookXsdOriginal, bookXsd2);
}
private Image getImage(String name) throws Exception {
@@ -287,7 +290,7 @@ public class JAXRSMultipartTest extends
@Test
public void testAddBookJaxbJsonImageWebClient() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbjsonimage";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbjsonimage";
WebClient client = WebClient.create(address);
client.type("multipart/mixed").accept("multipart/mixed");
@@ -316,7 +319,7 @@ public class JAXRSMultipartTest extends
@Test
public void testAddBookJaxbJsonImageAttachments() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbimagejson";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbimagejson";
WebClient client = WebClient.create(address);
client.type("multipart/mixed").accept("multipart/mixed");
@@ -345,7 +348,7 @@ public class JAXRSMultipartTest extends
@Test
public void testAddGetJaxbBooksWebClient() throws Exception {
- String address = "http://localhost:9085/bookstore/books/jaxbonly";
+ String address = "http://localhost:" + PORT + "/bookstore/books/jaxbonly";
WebClient client = WebClient.create(address);
client.type("multipart/mixed;type=application/xml").accept("multipart/mixed");
@@ -369,7 +372,7 @@ public class JAXRSMultipartTest extends
public void testAddGetImageWebClient() throws Exception {
InputStream is1 =
getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg");
- String address = "http://localhost:9085/bookstore/books/image";
+ String address = "http://localhost:" + PORT + "/bookstore/books/image";
WebClient client = WebClient.create(address);
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
@@ -387,7 +390,7 @@ public class JAXRSMultipartTest extends
public void testUploadImageFromForm() throws Exception {
InputStream is1 =
getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/java.jpg");
- String address = "http://localhost:9085/bookstore/books/formimage";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formimage";
WebClient client = WebClient.create(address);
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
@@ -419,7 +422,7 @@ public class JAXRSMultipartTest extends
public void testUploadImageFromForm2() throws Exception {
File file =
new File(getClass().getResource("/org/apache/cxf/systest/jaxrs/resources/java.jpg").getFile());
- String address = "http://localhost:9085/bookstore/books/formimage2";
+ String address = "http://localhost:" + PORT + "/bookstore/books/formimage2";
WebClient client = WebClient.create(address);
HTTPConduit conduit = WebClient.getConfig(client).getHttpConduit();
conduit.getClient().setReceiveTimeout(1000000);
@@ -439,7 +442,7 @@ public class JAXRSMultipartTest extends
@Test
public void testMultipartRequestNoBody() throws Exception {
- PostMethod post = new PostMethod("http://localhost:9085/bookstore/books/image");
+ PostMethod post = new PostMethod("http://localhost:" + PORT + "/bookstore/books/image");
String ct = "multipart/mixed";
post.setRequestHeader("Content-Type", ct);
HttpClient httpclient = new HttpClient();
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSMultithreadedClientTest.java Tue Jul 27 20:46:55 2010
@@ -41,6 +41,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSMultithreadedClientTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = BookServer.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -50,49 +51,49 @@ public class JAXRSMultithreadedClientTes
@Test
public void testStatefulWebClientWithCopy() throws Exception {
- runWebClients(WebClient.create("http://localhost:9080/bookstore"), 10, false, true);
+ runWebClients(WebClient.create("http://localhost:" + PORT + "/bookstore"), 10, false, true);
}
@Test
public void testStatefulWebClientThreadLocal() throws Exception {
- runWebClients(WebClient.create("http://localhost:9080/bookstore", true), 10, true, true);
+ runWebClients(WebClient.create("http://localhost:" + PORT + "/bookstore", true), 10, true, true);
}
@Test
public void testStatefulWebClientThreadLocalWithCopy() throws Exception {
- runWebClients(WebClient.create("http://localhost:9080/bookstore", true), 10, false, true);
+ runWebClients(WebClient.create("http://localhost:" + PORT + "/bookstore", true), 10, false, true);
}
@Test
public void testSimpleWebClient() throws Exception {
- WebClient client = WebClient.create("http://localhost:9080/bookstore/booksecho");
+ WebClient client = WebClient.create("http://localhost:" + PORT + "/bookstore/booksecho");
client.type("text/plain").accept("text/plain").header("CustomHeader", "CustomValue");
runWebClients(client, 10, true, false);
}
@Test
public void testSimpleProxy() throws Exception {
- BookStore proxy = JAXRSClientFactory.create("http://localhost:9080", BookStore.class);
+ BookStore proxy = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class);
runProxies(proxy, 10, true, false);
}
@Test
public void testThreadSafeProxy() throws Exception {
- BookStore proxy = JAXRSClientFactory.create("http://localhost:9080", BookStore.class,
+ BookStore proxy = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class,
Collections.emptyList(), true);
runProxies(proxy, 10, true, true);
}
@Test
public void testThreadSafeProxyWithCopy() throws Exception {
- BookStore proxy = JAXRSClientFactory.create("http://localhost:9080", BookStore.class,
+ BookStore proxy = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class,
Collections.emptyList(), true);
runProxies(proxy, 10, false, true);
}
@Test
public void testThreadSafeSubProxy() throws Exception {
- BookStore proxy = JAXRSClientFactory.create("http://localhost:9080", BookStore.class,
+ BookStore proxy = JAXRSClientFactory.create("http://localhost:" + PORT, BookStore.class,
Collections.emptyList(), true);
runProxies(proxy.echoThroughBookStoreSub(), 10, true, true);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSRequestDispatcherTest.java Tue Jul 27 20:46:55 2010
@@ -31,6 +31,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSRequestDispatcherTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = BookServerRequestDispatch.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -41,7 +42,7 @@ public class JAXRSRequestDispatcherTest
@Test
public void testGetBookHTML() throws Exception {
String endpointAddress =
- "http://localhost:9080/the/bookstore1/books/html/123";
+ "http://localhost:" + PORT + "/the/bookstore1/books/html/123";
WebClient client = WebClient.create(endpointAddress);
client.accept("text/html");
WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
@@ -59,7 +60,7 @@ public class JAXRSRequestDispatcherTest
@Ignore("JSP pages need to be precompiled by Maven build")
public void testGetBookJSPRequestScope() throws Exception {
String endpointAddress =
- "http://localhost:9080/the/bookstore2/books/html/123";
+ "http://localhost:" + PORT + "/the/bookstore2/books/html/123";
WebClient client = WebClient.create(endpointAddress);
client.accept("text/html");
WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
@@ -73,7 +74,7 @@ public class JAXRSRequestDispatcherTest
@Ignore("JSP pages need to be precompiled by Maven build")
public void testGetBookJSPSessionScope() throws Exception {
String endpointAddress =
- "http://localhost:9080/the/bookstore3/books/html/456";
+ "http://localhost:" + PORT + "/the/bookstore3/books/html/456";
WebClient client = WebClient.create(endpointAddress);
client.accept("text/html");
WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
@@ -85,7 +86,7 @@ public class JAXRSRequestDispatcherTest
@Test
public void testGetBookHTMLFromDefaultServlet() throws Exception {
String endpointAddress =
- "http://localhost:9080/the/bookstore4/books/html/123";
+ "http://localhost:" + PORT + "/the/bookstore4/books/html/123";
WebClient client = WebClient.create(endpointAddress);
client.accept("text/html");
WebClient.getConfig(client).getHttpConduit().getClient().setReceiveTimeout(100000000);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java Tue Jul 27 20:46:55 2010
@@ -69,17 +69,19 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSSoapBookTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = BookServerRestSoap.PORT;
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
- launchServer(BookServerRestSoap.class));
+ launchServer(BookServerRestSoap.class, true));
}
@Test
public void testGetAll() throws Exception {
- InputStream in = getHttpInputStream("http://localhost:9092/test/services/rest2/myRestService");
+ InputStream in = getHttpInputStream("http://localhost:" + PORT
+ + "/test/services/rest2/myRestService");
assertEquals("0", getStringFromInputStream(in));
}
@@ -88,7 +90,7 @@ public class JAXRSSoapBookTest extends A
public void testGetBookFastinfoset() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
- bean.setAddress("http://localhost:9092/test/services/rest3/bookstore/fastinfoset2");
+ bean.setAddress("http://localhost:" + PORT + "/test/services/rest3/bookstore/fastinfoset2");
bean.getInInterceptors().add(new FIStaxInInterceptor());
JAXBElementProvider p = new JAXBElementProvider();
p.setConsumeMediaTypes(Collections.singletonList("application/fastinfoset"));
@@ -108,7 +110,7 @@ public class JAXRSSoapBookTest extends A
public void testPostGetBookFastinfoset() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
- bean.setAddress("http://localhost:9092/test/services/rest3/bookstore/fastinfoset");
+ bean.setAddress("http://localhost:" + PORT + "/test/services/rest3/bookstore/fastinfoset");
bean.getOutInterceptors().add(new FIStaxOutInterceptor());
bean.getInInterceptors().add(new FIStaxInInterceptor());
JAXBElementProvider p = new JAXBElementProvider();
@@ -131,7 +133,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123ServletResponse() throws Exception {
- InputStream in = getHttpInputStream("http://localhost:9092/test/services/rest/bookstore/0");
+ InputStream in = getHttpInputStream("http://localhost:" + PORT + "/test/services/rest/bookstore/0");
InputStream expected = getClass().getResourceAsStream("resources/expected_get_book123.txt");
assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in));
@@ -140,7 +142,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123() throws Exception {
- InputStream in = getHttpInputStream("http://localhost:9092/test/services/rest/bookstore/123");
+ InputStream in = getHttpInputStream("http://localhost:" + PORT + "/test/services/rest/bookstore/123");
InputStream expected = getClass().getResourceAsStream("resources/expected_get_book123.txt");
assertEquals(getStringFromInputStream(expected), getStringFromInputStream(in));
@@ -150,7 +152,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123Client() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
HTTPConduit conduit = (HTTPConduit)WebClient.getConfig(proxy).getConduit();
@@ -170,7 +172,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123WebClient() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
WebClient client = WebClient.create(baseAddress);
client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
Book b = client.get(Book.class);
@@ -180,7 +182,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123XMLSource() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
WebClient client = WebClient.create(baseAddress);
client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
XMLSource source = client.get(XMLSource.class);
@@ -195,7 +197,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testNoBookWebClient() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
WebClient client = WebClient.create(baseAddress);
client.path("/bookstore/books/0/subresource").accept(MediaType.APPLICATION_XML_TYPE);
Book b = client.get(Book.class);
@@ -205,7 +207,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook123WebClientResponse() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
WebClient client = WebClient.create(baseAddress);
client.path("/bookstore/123").accept(MediaType.APPLICATION_XML_TYPE);
Book b = readBook((InputStream)client.get().getEntity());
@@ -216,7 +218,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBook356ClientException() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class,
Collections.singletonList(new TestResponseExceptionMapper()));
@@ -236,7 +238,7 @@ public class JAXRSSoapBookTest extends A
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("org.apache.cxf.http.throw_io_exceptions", Boolean.TRUE);
bean.setProperties(properties);
- bean.setAddress("http://localhost:9092/test/services/rest/bookstore/356");
+ bean.setAddress("http://localhost:" + PORT + "/test/services/rest/bookstore/356");
WebClient wc = bean.createWebClient();
Response response = wc.get();
assertEquals(404, response.getStatus());
@@ -248,7 +250,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testOtherInterceptorDrainingStream() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseAddress);
bean.getInInterceptors().add(new TestStreamDrainInterptor());
@@ -262,7 +264,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceClient() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
BookSubresource bs = proxy.getBookSubresource("125");
@@ -274,7 +276,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceClientNoProduces() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
BookSubresource bs = proxy.getBookSubresource("125");
@@ -286,7 +288,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceParamExtensions() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
BookSubresource bs = proxy.getBookSubresource("139");
@@ -299,7 +301,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testAddOrderFormBean() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
BookSubresource bs = proxy.getBookSubresource("139");
@@ -313,7 +315,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceWebClientParamExtensions() throws Exception {
- WebClient client = WebClient.create("http://localhost:9092/test/services/rest");
+ WebClient client = WebClient.create("http://localhost:" + PORT + "/test/services/rest");
client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
client.path("/bookstore/books/139/subresource4/139/CXF Rocks");
Book bean = new Book("CXF Rocks", 139L);
@@ -327,7 +329,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceClient2() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
doTestSubresource(proxy);
@@ -340,7 +342,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceWebClientProxyBean() throws Exception {
- WebClient client = WebClient.create("http://localhost:9092/test/services/rest");
+ WebClient client = WebClient.create("http://localhost:" + PORT + "/test/services/rest");
client.type(MediaType.TEXT_PLAIN_TYPE)
.accept(MediaType.APPLICATION_XML_TYPE, MediaType.TEXT_XML_TYPE);
BookStoreJaxrsJaxws proxy =
@@ -358,7 +360,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceWebClientProxy2() throws Exception {
- WebClient client = WebClient.create("http://localhost:9092/test/services/rest/bookstore")
+ WebClient client = WebClient.create("http://localhost:" + PORT + "/test/services/rest/bookstore")
.path("/books/378");
client.type(MediaType.TEXT_PLAIN_TYPE).accept(MediaType.APPLICATION_XML_TYPE);
BookSubresource proxy = JAXRSClientFactory.fromClient(client, BookSubresource.class);
@@ -388,7 +390,8 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookWebClientForm() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest/bookstore/books/679/subresource3";
+ String baseAddress = "http://localhost:" + PORT
+ + "/test/services/rest/bookstore/books/679/subresource3";
WebClient wc = WebClient.create(baseAddress);
MultivaluedMap<String, Object> map = new MetadataMap<String, Object>();
map.putSingle("id", "679");
@@ -403,7 +406,8 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookWebClientForm2() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest/bookstore/books/679/subresource3";
+ String baseAddress = "http://localhost:" + PORT
+ + "/test/services/rest/bookstore/books/679/subresource3";
WebClient wc = WebClient.create(baseAddress);
Form f = new Form();
f.set("id", "679").set("name", "CXF in Action - ")
@@ -417,7 +421,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSubresourceClientFormParam() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
BookSubresource bs = proxy.getBookSubresource("679");
@@ -428,7 +432,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testAddGetBook123WebClient() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
WebClient client = WebClient.create(baseAddress);
client.path("/bookstore/books").accept(MediaType.APPLICATION_XML_TYPE)
.type(MediaType.APPLICATION_XML_TYPE);
@@ -443,7 +447,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testAddGetBook123Client() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
BookStoreJaxrsJaxws proxy = JAXRSClientFactory.create(baseAddress,
BookStoreJaxrsJaxws.class);
Book b = new Book();
@@ -459,7 +463,7 @@ public class JAXRSSoapBookTest extends A
public void testAddGetBookRest() throws Exception {
String endpointAddress =
- "http://localhost:9092/test/services/rest/bookstore/books";
+ "http://localhost:" + PORT + "/test/services/rest/bookstore/books";
File input = new File(getClass().getResource("resources/add_book.txt").toURI());
PostMethod post = new PostMethod(endpointAddress);
@@ -485,7 +489,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testGetBookSoap() throws Exception {
String wsdlAddress =
- "http://localhost:9092/test/services/soap/bookservice?wsdl";
+ "http://localhost:" + PORT + "/test/services/soap/bookservice?wsdl";
URL wsdlUrl = new URL(wsdlAddress);
BookSoapService service =
new BookSoapService(wsdlUrl,
@@ -498,20 +502,20 @@ public class JAXRSSoapBookTest extends A
@Test
public void testServiceListingsAndWadl() throws Exception {
String listings =
- getStringFromInputStream(getHttpInputStream("http://localhost:9092/test/services"));
+ getStringFromInputStream(getHttpInputStream("http://localhost:" + PORT + "/test/services"));
assertNotNull(listings);
- assertTrue(listings.contains("http://localhost:9092/test/services/soap/bookservice?wsdl"));
- assertFalse(listings.contains("http://localhost:9092/test/services/soap/bookservice2?wsdl"));
+ assertTrue(listings.contains("http://localhost:" + PORT + "/test/services/soap/bookservice?wsdl"));
+ assertFalse(listings.contains("http://localhost:" + PORT + "/test/services/soap/bookservice2?wsdl"));
- assertTrue(listings.contains("http://localhost:9092/test/services/rest?_wadl&type=xml"));
+ assertTrue(listings.contains("http://localhost:" + PORT + "/test/services/rest?_wadl&type=xml"));
assertEquals(200, WebClient.create(
- "http://localhost:9092/test/services/rest?_wadl&type=xml").get().getStatus());
- assertTrue(listings.contains("http://localhost:9092/test/services/rest2?_wadl&type=xml"));
+ "http://localhost:" + PORT + "/test/services/rest?_wadl&type=xml").get().getStatus());
+ assertTrue(listings.contains("http://localhost:" + PORT + "/test/services/rest2?_wadl&type=xml"));
assertEquals(200, WebClient.create(
- "http://localhost:9092/test/services/rest2?_wadl&type=xml").get().getStatus());
- assertFalse(listings.contains("http://localhost:9092/test/services/rest3?_wadl&type=xml"));
+ "http://localhost:" + PORT + "/test/services/rest2?_wadl&type=xml").get().getStatus());
+ assertFalse(listings.contains("http://localhost:" + PORT + "/test/services/rest3?_wadl&type=xml"));
assertEquals(401, WebClient.create(
- "http://localhost:9092/test/services/rest3?_wadl&type=xml").get().getStatus());
+ "http://localhost:" + PORT + "/test/services/rest3?_wadl&type=xml").get().getStatus());
@@ -520,7 +524,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testAddFeatureToClient() throws Exception {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseAddress);
bean.setResourceClass(BookStoreJaxrsJaxws.class);
@@ -549,7 +553,7 @@ public class JAXRSSoapBookTest extends A
@Test
public void testClientFaultOutInterceptor() throws Exception {
//testing faults created by client out interceptor chain handled correctly
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseAddress);
bean.setResourceClass(BookStoreJaxrsJaxws.class);
@@ -573,7 +577,7 @@ public class JAXRSSoapBookTest extends A
}
private void serverFaultInInterceptorTest(String param) {
- String baseAddress = "http://localhost:9092/test/services/rest";
+ String baseAddress = "http://localhost:" + PORT + "/test/services/rest";
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(baseAddress);
bean.setResourceClass(BookStoreJaxrsJaxws.class);
Propchange: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSSoapBookTest.java
('svn:mergeinfo' removed)
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUriInfoTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUriInfoTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUriInfoTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JAXRSUriInfoTest.java Tue Jul 27 20:46:55 2010
@@ -33,7 +33,7 @@ import org.junit.Ignore;
import org.junit.Test;
public class JAXRSUriInfoTest extends AbstractClientServerTestBase {
-
+ public static final String PORT = SpringServer.PORT;
@BeforeClass
public static void beforeClass() throws Exception {
// must be 'in-process' to communicate with inner class in single JVM
@@ -44,7 +44,7 @@ public class JAXRSUriInfoTest extends Ab
@Ignore
public static class SpringServer extends AbstractSpringServer {
public SpringServer() {
- super("/jaxrs_uriinfo", "/app", 9080);
+ super("/jaxrs_uriinfo", "/app");
}
}
@@ -60,24 +60,24 @@ public class JAXRSUriInfoTest extends Ab
*/
@Test
public void testBasePathAndPathAndPathParam() throws Exception {
- checkUriInfo("http://localhost:9080/app/v1", "\"\"", "/");
- checkUriInfo("http://localhost:9080/app/v1/", "\"\"", "/");
- checkUriInfo("http://localhost:9080/app/v1/test", "\"test\"", "test");
- checkUriInfo("http://localhost:9080/app/v1/", "\"\"", "/");
- checkUriInfo("http://localhost:9080/app/v1", "\"\"", "/");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1", "\"\"", "/");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/", "\"\"", "/");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/test", "\"test\"", "test");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/", "\"\"", "/");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1", "\"\"", "/");
- checkUriInfo("http://localhost:9080/app/v1/bar", "\"bar\"", "bar");
- checkUriInfo("http://localhost:9080/app/v1/bar", "\"bar\"", "bar");
- checkUriInfo("http://localhost:9080/app/v1/bar/test", "\"bar/test\"", "bar/test");
- checkUriInfo("http://localhost:9080/app/v1/bar", "\"bar\"", "bar");
- checkUriInfo("http://localhost:9080/app/v1/bar", "\"bar\"", "bar");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/bar", "\"bar\"", "bar");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/bar", "\"bar\"", "bar");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/bar/test", "\"bar/test\"", "bar/test");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/bar", "\"bar\"", "bar");
+ checkUriInfo("http://localhost:" + PORT + "/app/v1/bar", "\"bar\"", "bar");
}
private void checkUriInfo(String address, String path, String pathParam) {
WebClient wc = WebClient.create(address);
wc.accept("text/plain");
String data = wc.get(String.class);
- assertEquals("http://localhost:9080/app/v1/," + path + "," + pathParam, data);
+ assertEquals("http://localhost:" + PORT + "/app/v1/," + path + "," + pathParam, data);
}
@Ignore
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/JMSBookStore.java Tue Jul 27 20:46:55 2010
@@ -47,6 +47,7 @@ import javax.xml.bind.Marshaller;
import org.apache.cxf.jaxrs.ext.Oneway;
import org.apache.cxf.jaxrs.ext.ProtocolHeaders;
+import org.apache.cxf.testutil.common.EmbeddedJMSBrokerLauncher;
import org.apache.cxf.transport.jms.JMSUtils;
@Path("/bookstore")
@@ -135,7 +136,7 @@ public class JMSBookStore {
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
- props.setProperty(Context.PROVIDER_URL, "tcp://localhost:61500");
+ props.setProperty(Context.PROVIDER_URL, "tcp://localhost:" + EmbeddedJMSBrokerLauncher.PORT);
return new InitialContext(props);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartServer.java Tue Jul 27 20:46:55 2010
@@ -24,14 +24,14 @@ import org.apache.cxf.jaxrs.lifecycle.Si
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class MultipartServer extends AbstractBusTestServerBase {
-
+ public static final String PORT = allocatePort(MultipartServer.class);
protected void run() {
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setResourceClasses(MultipartStore.class);
//default lifecycle is per-request, change it to singleton
sf.setResourceProvider(MultipartStore.class,
new SingletonResourceProvider(new MultipartStore()));
- sf.setAddress("http://localhost:9085/");
+ sf.setAddress("http://localhost:" + PORT + "/");
sf.create();
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/MultipartStore.java Tue Jul 27 20:46:55 2010
@@ -30,6 +30,8 @@ import java.util.Map;
import javax.activation.DataHandler;
import javax.activation.DataSource;
+import javax.imageio.ImageIO;
+import javax.mail.util.ByteArrayDataSource;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
@@ -70,8 +72,8 @@ public class MultipartStore {
@POST
@Path("/xop")
@Consumes("multipart/related")
- @Produces("text/plain")
- public String addBookXop(XopType type) throws Exception {
+ @Produces("multipart/related;type=text/xml")
+ public XopType addBookXop(XopType type) throws Exception {
if (!"xopName".equals(type.getName())) {
throw new RuntimeException("Wrong name property");
}
@@ -84,7 +86,25 @@ public class MultipartStore {
if (!Boolean.getBoolean("java.awt.headless") && type.getImage() == null) {
throw new RuntimeException("Wrong image property");
}
- return type.getName() + bookXsd + new String(type.getAttachinfo2());
+ context.put(org.apache.cxf.message.Message.MTOM_ENABLED,
+ (Object)"true");
+
+ XopType xop = new XopType();
+ xop.setName("xopName");
+ InputStream is =
+ getClass().getResourceAsStream("/org/apache/cxf/systest/jaxrs/resources/book.xsd");
+ byte[] data = IOUtils.readBytesFromStream(is);
+ xop.setAttachinfo(new DataHandler(new ByteArrayDataSource(data, "application/octet-stream")));
+
+ xop.setAttachinfo2(bookXsd.getBytes());
+
+ if (Boolean.getBoolean("java.awt.headless")) {
+ System.out.println("Running headless. Ignoring an Image property.");
+ } else {
+ xop.setImage(ImageIO.read(getClass().getResource(
+ "/org/apache/cxf/systest/jaxrs/resources/java.jpg")));
+ }
+ return xop;
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/formRequest.txt Tue Jul 27 20:46:55 2010
@@ -3,7 +3,6 @@ Accept: image/gif, image/x-xbitmap, imag
Accept-Language: en-ie
Content-Type: application/x-www-form-urlencoded
UA-CPU: x86
-Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; iOpus-Web-Automation; .NET CLR 2.0.50727)
Host: localhost:9080
Content-Length: 27
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/jms_server_config.xml Tue Jul 27 20:46:55 2010
@@ -33,9 +33,11 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-jms.xml" />
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"
- p:brokerURL="tcp://localhost:61500"/>
+ p:brokerURL="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
<bean id="singleConnectionFactory"
class="org.springframework.jms.connection.SingleConnectionFactory" destroy-method="destroy">
@@ -53,7 +55,7 @@ http://cxf.apache.org/schemas/jaxrs.xsd"
<jms:address jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/test.jmstransport.text">
<jms:JMSNamingProperty name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
- <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:61500"/>
+ <jms:JMSNamingProperty name="java.naming.provider.url" value="tcp://localhost:${testutil.ports.EmbeddedJMSBrokerLauncher}"/>
</jms:address>
<jms:jmsConfig-ref>jmsConfig</jms:jmsConfig-ref>
</jms:destination>
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush.properties Tue Jul 27 20:46:55 2010
@@ -20,6 +20,7 @@ org.apache.cxf.endpoint.level = OFF
org.apache.cxf.resource.level = OFF
org.springframework.level = OFF
org.mortbay.level = OFF
+org.eclipse.level = OFF
org.apache.axiom.level = OFF
org.apache.cxf.ws.policy.level = OFF
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_atompub.properties Tue Jul 27 20:46:55 2010
@@ -20,6 +20,7 @@ org.apache.cxf.endpoint.level = OFF
org.apache.cxf.resource.level = OFF
org.springframework.level = OFF
org.mortbay.level = OFF
+org.eclipse.level = OFF
org.apache.axiom.level = OFF
org.apache.cxf.ws.policy.level = OFF
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_batch.properties Tue Jul 27 20:46:55 2010
@@ -20,6 +20,7 @@ org.apache.cxf.endpoint.level = OFF
org.apache.cxf.resource.level = OFF
org.springframework.level = OFF
org.mortbay.level = OFF
+org.eclipse.level = OFF
org.apache.axiom.level = OFF
# Atom handler specific settings
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_disabled.properties
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_disabled.properties?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_disabled.properties (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/resources/logging_atompush_disabled.properties Tue Jul 27 20:46:55 2010
@@ -11,5 +11,6 @@ org.apache.cxf.endpoint.level = OFF
org.apache.cxf.resource.level = OFF
org.springframework.level = OFF
org.mortbay.level = OFF
+org.eclipse.level = OFF
org.apache.axiom.level = OFF
org.apache.cxf.ws.policy.level = OFF
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookHttpsServer.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookHttpsServer.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookHttpsServer.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/BookHttpsServer.java Tue Jul 27 20:46:55 2010
@@ -26,9 +26,11 @@ import org.apache.cxf.jaxrs.JAXRSServerF
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
import org.apache.cxf.systest.jaxrs.BookStore;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+import org.apache.cxf.testutil.common.TestUtil;
public class BookHttpsServer extends AbstractBusTestServerBase {
-
+ public static final String PORT = TestUtil.getPortNumber("jaxrs-https");
+
private static final String SERVER_CONFIG_FILE =
"org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml";
@@ -43,7 +45,7 @@ public class BookHttpsServer extends Abs
//default lifecycle is per-request, change it to singleton
sf.setResourceProvider(BookStore.class,
new SingletonResourceProvider(new BookStore()));
- sf.setAddress("https://localhost:9095/");
+ sf.setAddress("https://localhost:" + PORT + "/");
sf.create();
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSHttpsBookTest.java Tue Jul 27 20:46:55 2010
@@ -31,6 +31,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class JAXRSHttpsBookTest extends AbstractBusClientServerTestBase {
+ public static final String PORT = BookHttpsServer.PORT;
private static final String CLIENT_CONFIG_FILE =
"org/apache/cxf/systest/jaxrs/security/jaxrs-https.xml";
@@ -46,10 +47,10 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123Proxy() throws Exception {
- BookStore bs = JAXRSClientFactory.create("https://localhost:9095", BookStore.class,
+ BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
CLIENT_CONFIG_FILE);
// just to verify the interface call goes through CGLIB proxy too
- assertEquals("https://localhost:9095", WebClient.client(bs).getBaseURI().toString());
+ assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
Book b = bs.getSecureBook("123");
assertEquals(b.getId(), 123);
b = bs.getSecureBook("123");
@@ -59,10 +60,10 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123ProxyWithURLConduitId() throws Exception {
- BookStore bs = JAXRSClientFactory.create("https://localhost:9095", BookStore.class,
+ BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
CLIENT_CONFIG_FILE2);
// just to verify the interface call goes through CGLIB proxy too
- assertEquals("https://localhost:9095", WebClient.client(bs).getBaseURI().toString());
+ assertEquals("https://localhost:" + PORT, WebClient.client(bs).getBaseURI().toString());
Book b = bs.getSecureBook("123");
assertEquals(b.getId(), 123);
b = bs.getSecureBook("123");
@@ -73,7 +74,7 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123ProxyToWebClient() throws Exception {
- BookStore bs = JAXRSClientFactory.create("https://localhost:9095", BookStore.class,
+ BookStore bs = JAXRSClientFactory.create("https://localhost:" + PORT, BookStore.class,
CLIENT_CONFIG_FILE);
Book b = bs.getSecureBook("123");
assertEquals(b.getId(), 123);
@@ -87,7 +88,7 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123WebClientToProxy() throws Exception {
- WebClient wc = WebClient.create("https://localhost:9095", CLIENT_CONFIG_FILE);
+ WebClient wc = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE);
wc.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
Book b = wc.get(Book.class);
assertEquals(123, b.getId());
@@ -104,8 +105,8 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123WebClient() throws Exception {
- WebClient client = WebClient.create("https://localhost:9095", CLIENT_CONFIG_FILE);
- assertEquals("https://localhost:9095", client.getBaseURI().toString());
+ WebClient client = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE);
+ assertEquals("https://localhost:" + PORT, client.getBaseURI().toString());
client.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
Book b = client.get(Book.class);
@@ -116,8 +117,8 @@ public class JAXRSHttpsBookTest extends
@Test
public void testGetBook123WebClientWithURLConduitId() throws Exception {
- WebClient client = WebClient.create("https://localhost:9095", CLIENT_CONFIG_FILE2);
- assertEquals("https://localhost:9095", client.getBaseURI().toString());
+ WebClient client = WebClient.create("https://localhost:" + PORT, CLIENT_CONFIG_FILE2);
+ assertEquals("https://localhost:" + PORT, client.getBaseURI().toString());
client.path("/bookstore/securebooks/123").accept(MediaType.APPLICATION_XML_TYPE);
Book b = client.get(Book.class);
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityClassTest.java Tue Jul 27 20:46:55 2010
@@ -33,7 +33,8 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class JAXRSSpringSecurityClassTest extends AbstractSpringSecurityTest {
-
+ public static final String PORT = BookServerSecuritySpringClass.PORT;
+
@BeforeClass
public static void startServers() throws Exception {
assertTrue("server did not launch correctly",
@@ -43,14 +44,14 @@ public class JAXRSSpringSecurityClassTes
@Test
public void testFailedAuthentication() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "ba", 401);
}
@Test
public void testBookFromForm() throws Exception {
- WebClient wc = WebClient.create("http://localhost:9080/bookstorestorage/bookforms",
+ WebClient wc = WebClient.create("http://localhost:" + PORT + "/bookstorestorage/bookforms",
"foo", "bar", null);
Response r = wc.form(new Form().set("name", "CXF Rocks").set("id", "123"));
@@ -63,7 +64,7 @@ public class JAXRSSpringSecurityClassTes
@Test
public void testGetBookUserAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
}
@@ -72,7 +73,7 @@ public class JAXRSSpringSecurityClassTes
@Test
public void testGetBookUser() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
}
@@ -80,7 +81,7 @@ public class JAXRSSpringSecurityClassTes
@Test
public void testGetBookAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
@@ -94,7 +95,7 @@ public class JAXRSSpringSecurityClassTes
@Test
public void testGetBookSubresourceAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/securebook/self";
+ "http://localhost:" + PORT + "/bookstorestorage/securebook/self";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityInterfaceTest.java Tue Jul 27 20:46:55 2010
@@ -30,6 +30,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class JAXRSSpringSecurityInterfaceTest extends AbstractSpringSecurityTest {
+ public static final String PORT = BookServerSecuritySpringInterface.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -40,14 +41,14 @@ public class JAXRSSpringSecurityInterfac
@Test
public void testFailedAuthentication() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "ba", 401);
}
@Test
public void testGetBookUserAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
}
@@ -55,7 +56,7 @@ public class JAXRSSpringSecurityInterfac
@Test
public void testGetBookUser() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
getBook(endpointAddress, "baddy", "baddyspassword", 403);
@@ -64,7 +65,7 @@ public class JAXRSSpringSecurityInterfac
@Test
public void testGetBookAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
@@ -72,32 +73,32 @@ public class JAXRSSpringSecurityInterfac
@Test
public void testGetBookSubresource() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/subresource";
+ "http://localhost:" + PORT + "/bookstorestorage/subresource";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
@Test
public void testWebClientAdmin() throws Exception {
- String address = "http://localhost:9080/bookstorestorage/thosebooks";
+ String address = "http://localhost:" + PORT + "/bookstorestorage/thosebooks";
doGetBookWebClient(address, "foo", "bar", 200);
}
@Test
public void testProxyClientAdmin() throws Exception {
- String address = "http://localhost:9080/bookstorestorage";
+ String address = "http://localhost:" + PORT + "/bookstorestorage";
doGetBookProxyClient(address, "foo", "bar", 200);
}
@Test
public void testWebClientUserUnauthorized() throws Exception {
- String address = "http://localhost:9080/bookstorestorage/thosebooks";
+ String address = "http://localhost:" + PORT + "/bookstorestorage/thosebooks";
doGetBookWebClient(address, "bob", "bobspassword", 403);
}
@Test
public void testWebClientUserAuthorized() throws Exception {
- String address = "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ String address = "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123/123";
doGetBookWebClient(address, "bob", "bobspassword", 200);
}
@@ -124,7 +125,7 @@ public class JAXRSSpringSecurityInterfac
@Test
public void testGetBookSubresourceAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/securebook/self";
+ "http://localhost:" + PORT + "/bookstorestorage/securebook/self";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
Modified: cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java?rev=979862&r1=979861&r2=979862&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java (original)
+++ cxf/sandbox/oauth_1.0a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/security/JAXRSSpringSecurityNoAnnotationsTest.java Tue Jul 27 20:46:55 2010
@@ -23,6 +23,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class JAXRSSpringSecurityNoAnnotationsTest extends AbstractSpringSecurityTest {
+ public static final String PORT = BookServerSecuritySpringInterface.PORT;
@BeforeClass
public static void startServers() throws Exception {
@@ -33,14 +34,14 @@ public class JAXRSSpringSecurityNoAnnota
@Test
public void testFailedAuthentication() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "ba", 401);
}
@Test
public void testGetBookUserAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
}
@@ -49,7 +50,7 @@ public class JAXRSSpringSecurityNoAnnota
@Test
public void testGetBookUser() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks/123/123";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks/123/123";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 200);
}
@@ -57,7 +58,7 @@ public class JAXRSSpringSecurityNoAnnota
@Test
public void testGetBookAdmin() throws Exception {
String endpointAddress =
- "http://localhost:9080/bookstorestorage/thosebooks";
+ "http://localhost:" + PORT + "/bookstorestorage/thosebooks";
getBook(endpointAddress, "foo", "bar", 200);
getBook(endpointAddress, "bob", "bobspassword", 403);
}
|