本文整理汇总了Java中org.kuali.rice.ksb.messaging.remotedservices.TestServiceInterface类的典型用法代码示例。如果您正苦于以下问题:Java TestServiceInterface类的具体用法?Java TestServiceInterface怎么用?Java TestServiceInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestServiceInterface类属于org.kuali.rice.ksb.messaging.remotedservices包,在下文中一共展示了TestServiceInterface类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClustering
import org.kuali.rice.ksb.messaging.remotedservices.TestServiceInterface; //导入依赖的package包/类
@Test public void testClustering() throws Exception {
QName serviceName = new QName("KEW", "testServiceFailover");
List<TestServiceInterface> services = new ArrayList<TestServiceInterface>();
int i = 0;
while (i < SERVICE_CALLS) {
i++;
services.add((TestServiceInterface) GlobalResourceLoader.getService(serviceName));
}
for (TestServiceInterface service : services) {
service.invoke();
}
String server1Name = "TestClient1";
String server2Name = "TestClient2";
boolean server1Called = false;
boolean server2Called = false;
//verify clustering is happening
List<BAMTargetEntry> bams = KSBServiceLocator.getBAMService().getCallsForService(serviceName);
for (BAMTargetEntry bam : bams) {
if (bam.getServiceURL().contains(server1Name)) {
server1Called = true;
} else if (bam.getServiceURL().contains(server2Name)) {
server2Called = true;
}
}
assertTrue(server1Called);
assertTrue(server2Called);
}
示例2: testServiceFailOver
import org.kuali.rice.ksb.messaging.remotedservices.TestServiceInterface; //导入依赖的package包/类
/**
* The services published to the service def table when ServiceCallClusterTest runs used to have
* have two different application IDs, TestCl1 and TestCl2. A fix was contributed from IU so that when a
* service fails, it fails over to services only using the same application ID. This is correct, but it made
* the tests no longer work. The tests now bring up services with the same application ID, TestCl1.
*/
@Test public void testServiceFailOver() throws Exception {
QName serviceName = new QName("KEW", "testServiceFailover");
List<TestServiceInterface> services = new ArrayList<TestServiceInterface>();
int i = 0;
while (i < SERVICE_CALLS) {
i++;
services.add((TestServiceInterface)GlobalResourceLoader.getService(serviceName));
}
String server1Name = "TestClient1";
String server2Name = "TestClient2";
boolean server1Called = false;
boolean server2Called = false;
//stop the server 1 and verify all calls going to server 2
try {
getTestClient1().stop();
} catch (Throwable t) {
// this is okay
}
for (TestServiceInterface service : services) {
service.invoke();
}
List<BAMTargetEntry> bams = KSBServiceLocator.getBAMService().getCallsForService(serviceName);
for (BAMTargetEntry bam : bams) {
if (bam.getServiceURL().contains(server1Name) && bam.getServerInvocation()) {
server1Called = true;
} else if (bam.getServiceURL().contains(server2Name)) {
server2Called = true;
}
}
assertFalse("server1 should not have been called", server1Called);
assertTrue("server2 should have been called", server2Called);
}
示例3: testDefaultToLocalService
import org.kuali.rice.ksb.messaging.remotedservices.TestServiceInterface; //导入依赖的package包/类
@Test public void testDefaultToLocalService() throws Exception {
QName serviceName = new QName("KEW", "testLocalServiceFavoriteCall");
List<TestServiceInterface> services = new ArrayList<TestServiceInterface>();
int i = 0;
while (i < SERVICE_CALLS) {
i++;
services.add((TestServiceInterface)GlobalResourceLoader.getService(serviceName));
}
for (TestServiceInterface service : services) {
service.invoke();
}
String testHarness = "en-test";
String server1Name = "TestClient1";
boolean localCalled = false;
boolean server1Called = false;
//verify clustering is happening
List<BAMTargetEntry> bams = KSBServiceLocator.getBAMService().getCallsForService(serviceName);
for (BAMTargetEntry bam : bams) {
if (bam.getServiceURL().contains(server1Name)) {
server1Called = true;
} else if (bam.getServiceURL().contains(testHarness)) {
localCalled = true;
}
}
assertFalse("BAM should not have recorded locally called services", localCalled);
assertFalse("Remotely deployed service should have never been called in favor of remote service", server1Called);
assertTrue("Service should have been called locally", GenericTestService.NUM_CALLS > 0);
}