Author: hiranya
Date: Wed Dec 7 13:30:46 2011
New Revision: 1211430
URL: http://svn.apache.org/viewvc?rev=1211430&view=rev
Log:
Endpoint samples SYNAPS-746
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample50.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample51.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample52.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample54.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample55.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample56.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample57.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample58.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample59.java
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/message/Sample0.java
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java?rev=1211430&r1=1211429&r2=1211430&view=diff
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
(original)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/SynapseTestCase.java
Wed Dec 7 13:30:46 2011
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.samples.framework.clients.EventSampleClient;
@@ -59,12 +60,11 @@ public abstract class SynapseTestCase ex
this.sampleId = sampleId;
log.info("Creating Synapse TestCase for test " + sampleId);
currentLocation = System.getProperty("user.dir") + File.separator;
- sampleDescriptor = File.separator + "sample" + sampleId + ".xml";
+ sampleDescriptor = "/sample" + sampleId + ".xml";
configuration = new SampleConfiguration();
backendServerControllers = new ArrayList<BackEndServerController>();
- System.setProperty("java.io.tmpdir", currentLocation + "modules" +
File.separator +
- "integration" + File.separator + "target" + File.separator +
"temp");
-
+ System.setProperty("java.io.tmpdir", FilenameUtils.normalize(
+ currentLocation + "modules/integration/target/temp"));
}
/**
@@ -412,19 +412,21 @@ public abstract class SynapseTestCase ex
SampleConfigConstants.TAG_CLIENT_CONF_AXIS2_XML);
if (clientRepo == null) {
- configuration.getClientConfig().setClientRepo(currentLocation +
- SampleConfigConstants.DEFAULT_CLIENT_CONF_REPO);
+
configuration.getClientConfig().setClientRepo(FilenameUtils.normalize(
+ currentLocation +
SampleConfigConstants.DEFAULT_CLIENT_CONF_REPO));
} else {
log.info("Using client Axis2 repository location: " + clientRepo);
- configuration.getClientConfig().setClientRepo(currentLocation +
clientRepo);
+
configuration.getClientConfig().setClientRepo(FilenameUtils.normalize(
+ currentLocation + clientRepo));
}
if (clientAxis2Xml == null) {
- configuration.getClientConfig().setAxis2Xml(currentLocation +
- SampleConfigConstants.DEFAULT_CLIENT_CONF_AXIS2_XML);
+
configuration.getClientConfig().setAxis2Xml(FilenameUtils.normalize(
+ currentLocation +
SampleConfigConstants.DEFAULT_CLIENT_CONF_AXIS2_XML));
} else {
log.info("Using client Axis2 XML: " + clientAxis2Xml);
- configuration.getClientConfig().setAxis2Xml(currentLocation +
clientAxis2Xml);
+
configuration.getClientConfig().setAxis2Xml(FilenameUtils.normalize(
+ currentLocation + clientAxis2Xml));
}
return true;
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java?rev=1211430&r1=1211429&r2=1211430&view=diff
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
(original)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/TestSamplesHandlerSuite.java
Wed Dec 7 13:30:46 2011
@@ -22,6 +22,7 @@ package org.apache.synapse.samples.frame
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.tests.endpoint.*;
import org.apache.synapse.samples.framework.tests.message.*;
import java.util.ArrayList;
@@ -169,5 +170,17 @@ public class TestSamplesHandlerSuite ext
sampleClassRepo.put("13", Sample13.class);
sampleClassRepo.put("15", Sample15.class);
sampleClassRepo.put("16", Sample16.class);
+
+ //Endpoint
+ sampleClassRepo.put("50", Sample50.class);
+ sampleClassRepo.put("51", Sample51.class);
+ sampleClassRepo.put("52", Sample52.class);
+ sampleClassRepo.put("53", Sample53.class);
+ sampleClassRepo.put("54", Sample54.class);
+ sampleClassRepo.put("55", Sample55.class);
+ sampleClassRepo.put("56", Sample56.class);
+ //sampleClassRepo.put("57", Sample57.class); //intermittently fail
+ sampleClassRepo.put("58", Sample58.class);
+ sampleClassRepo.put("59", Sample59.class);
}
}
\ No newline at end of file
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample50.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample50.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample50.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample50.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample50 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample50.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+
+ public Sample50() {
+ super(50);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testRestToPox() {
+ String ep = "http://localhost:8280/services/MTOMSwASampleService";
+ String trpUrl = "http://localhost:8280/services/StockQuote";
+
+ log.info("Running test: HTTP REST request ");
+ result = client.requestRestQuote(null, trpUrl, null, "IBM");
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample51.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample51.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample51.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample51.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.MTOMSwASampleClient;
+
+import java.io.File;
+
+public class Sample51 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample51.class);
+ SampleClientResult result;
+ MTOMSwASampleClient client;
+
+ public Sample51() {
+ super(51);
+ client = getMTOMSwASampleClient();
+ }
+
+ public void testMTOMOptimization() {
+ String ep = "http://localhost:8280/services/MTOMSwASampleService";
+ String currentLocation = System.getProperty("user.dir") +
File.separator;
+ String filename = FilenameUtils.normalize(
+ currentLocation +
"repository/conf/sample/resources/mtom/asf-logo.gif");
+ log.info("Running test: MTOM optimization and request/response
correlation ");
+ result = client.sendUsingMTOM(filename, ep);
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+
+ public void testSWAOptimization() {
+ String ep = "http://localhost:8280/services/MTOMSwASampleService";
+ String currentLocation = System.getProperty("user.dir") +
File.separator;
+ String filename = FilenameUtils.normalize(
+ currentLocation +
"repository/conf/sample/resources/mtom/asf-logo.gif");
+
+ log.info("Running test:SwA optimization and request/response
correlation ");
+ result = client.sendUsingSWA(filename, ep);
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample52.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample52.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample52.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample52.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample52 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample52.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+
+ public Sample52() {
+ super(52);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testSessionLessLB() {
+ //String repo = getConfiguration().getClientConfig().getClientRepo();
+ String addUrl = "http://localhost:8280/services/LBService1";
+
+ log.info("Running test: Session-less load balancing between 3
endpoints");
+ result = client.sessionlessClient(addUrl, null, 100);
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample53.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.axis2.AxisFault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample53 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample53.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+ String addUrl;
+
+ public Sample53() {
+ super(53);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testFailOver() {
+ String expectedError = "COULDN'T SEND THE MESSAGE TO THE SERVER";
+ addUrl = "http://localhost:8280/services/LBService1";
+ log.info("Running test: Failover sending among 3 endpoints");
+
+ new Thread(new Runnable() {
+ public void run() {
+ result = client.sessionlessClient(addUrl, null, -1);
+ }
+ }).start();
+
+ for (int i = 0; i < 3; i++) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ getBackendServerControllers().get(i).stop();
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+
+ while (!result.isFinished()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ assertTrue("Did not receive a response", result.gotResponse());
+ Exception resultEx = result.getException();
+ assertNotNull("Did not receive expected error", resultEx);
+ log.info("Got an error as expected: " + resultEx.getMessage());
+ assertTrue("Did not receive expected error", resultEx instanceof
AxisFault);
+ assertTrue("Did not receive expected error",
+ resultEx.getMessage().indexOf(expectedError) != -1);
+ }
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample54.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample54.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample54.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample54.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+import java.util.concurrent.CountDownLatch;
+
+public class Sample54 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample54.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+ CountDownLatch latch;
+
+ public Sample54() {
+ super(54);
+ client = getStockQuoteClient();
+ latch = new CountDownLatch(1);
+ }
+
+
+ public void testSessionFullLB() {
+ String addUrl = "http://localhost:8280/services/LBService1";
+
+ log.info("Running test: Session affinity load balancing between 3
endpoints");
+ result = client.statefulClient(addUrl,null, 100);
+ assertTrue("Client did not run successfully ", result.gotResponse());
+ }
+
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample55.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample55.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample55.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample55.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample55 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample55.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+ String addUrl;
+
+ public Sample55() {
+ super(55);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testSessionFullLBFailOver() {
+ addUrl = "http://localhost:8280/services/LBService1";
+
+ log.info("Running test: Failover sending among 3 endpoints");
+ new Thread(new Runnable() {
+ public void run() {
+ result = client.statefulClient(addUrl,null, 200);
+ }
+ }).start();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ getBackendServerControllers().get(0).stop();
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+
+ assertTrue("Did not receive a response", result.gotResponse());
+ }
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample56.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample56.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample56.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample56.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample56 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample56.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+
+ public Sample56() {
+ super(56);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testSmartClientMode() {
+ String addUrl = "http://localhost:8280";
+
+ log.info("Running test: Smart Client mode");
+ result = client.requestStandardQuote(addUrl, null, null, "IBM" ,null);
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample57.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample57.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample57.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample57.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample57 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample57.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+ String addUrl;
+
+ public Sample57() {
+ super(57);
+ client = getStockQuoteClient();
+ }
+
+ public void testDynamicLB() {
+ addUrl = "http://localhost:8280/services/LBService1";
+
+ log.info("Running test: Dynamic load balancing between 3 nodes");
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ }
+ new Thread(new Runnable() {
+ public void run() {
+ result = client.sessionlessClient(addUrl, null, 500);
+ }
+ }).start();
+// try {
+// Thread.sleep(2000);
+// } catch (InterruptedException e) {
+//
+// }
+// getbESControllers().get("SampleServer0").stop();
+//
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+
+ }
+ new Thread(new Runnable() {
+ public void run() {
+ result = client.sessionlessClient(addUrl, null, 500);
+ }
+ }).start();
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+
+ }
+
+ assertTrue("Did not receive a response", result.gotResponse());
+ }
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample58.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample58.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample58.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample58.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample58 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample58.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+ String addUrl;
+
+ public Sample58() {
+ super(58);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testStaticLB() {
+ addUrl = "http://localhost:8280/services/LBService1";
+
+ new Thread(new Runnable() {
+ public void run() {
+ result = client.sessionlessClient(addUrl,null, 200);
+ }
+ }).start();
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ getBackendServerControllers().get(0).stop();
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+
+ }
+ }
+}
Added:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample59.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample59.java?rev=1211430&view=auto
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample59.java
(added)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/endpoint/Sample59.java
Wed Dec 7 13:30:46 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.synapse.samples.framework.tests.endpoint;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.samples.framework.SampleClientResult;
+import org.apache.synapse.samples.framework.SynapseTestCase;
+import org.apache.synapse.samples.framework.clients.StockQuoteSampleClient;
+
+public class Sample59 extends SynapseTestCase {
+
+ private static final Log log = LogFactory.getLog(Sample59.class);
+ SampleClientResult result;
+ StockQuoteSampleClient client;
+
+ public Sample59() {
+ super(59);
+ client = getStockQuoteClient();
+ }
+
+
+ public void testSessionLessLB() {
+ String addUrl = "http://localhost:8280/services/LBService1";
+
+ log.info("Running test: Weighted load balancing between 3 endpoints");
+ result = client.sessionlessClient(addUrl,null, 100);
+ assertTrue("Client did not get run successfully ",
result.gotResponse());
+ }
+
+
+}
Modified:
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/message/Sample0.java
URL:
http://svn.apache.org/viewvc/synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/message/Sample0.java?rev=1211430&r1=1211429&r2=1211430&view=diff
==============================================================================
---
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/message/Sample0.java
(original)
+++
synapse/trunk/java/modules/integration/src/test/java/org/apache/synapse/samples/framework/tests/message/Sample0.java
Wed Dec 7 13:30:46 2011
@@ -51,7 +51,7 @@ public class Sample0 extends SynapseTest
String prxUrl = "http://localhost:8280/";
log.info("Running test: Using Synapse as a HTTP Proxy");
- result = client.requestStandardQuote(addUrl, null, prxUrl, "IBM"
,null);
+ result = client.requestStandardQuote(addUrl, null, prxUrl, "IBM",
null);
assertTrue("Client did not get run successfully ",
result.gotResponse());
}