当前位置: 首页>>代码示例>>Java>>正文


Java KSBJavaService.invoke方法代码示例

本文整理汇总了Java中org.kuali.rice.ksb.messaging.service.KSBJavaService.invoke方法的典型用法代码示例。如果您正苦于以下问题:Java KSBJavaService.invoke方法的具体用法?Java KSBJavaService.invoke怎么用?Java KSBJavaService.invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.ksb.messaging.service.KSBJavaService的用法示例。


在下文中一共展示了KSBJavaService.invoke方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCallingQueueAsnyc

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
   public void testCallingQueueAsnyc() throws Exception {

KSBTestUtils.setMessagingToAsync();
QName serviceName = new QName("testAppsSharedQueue", "sharedQueue");
String contextObject = "my_context_object";
SimpleCallback callback = new SimpleCallback();

	KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, callback, contextObject);
    
synchronized (callback) {
    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
    callback.waitForAsyncCall();
}

Object contextAfterMessaging = callback.getMethodCall().getContext();
assertEquals(contextObject, contextAfterMessaging);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:ContextObjectMessagingTest.java

示例2: testCallingAsyncTopics

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
   public void testCallingAsyncTopics() throws Exception {
KSBTestUtils.setMessagingToAsync();
QName serviceName = new QName("testAppsSharedTopic", "sharedTopic");

SimpleCallback callback = new SimpleCallback();
String contextObject = "my_context_object";
	KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, callback, contextObject);

synchronized (callback) {
    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
    callback.waitForAsyncCall();    
}

Object contextAfterMessaging = callback.getMethodCall().getContext();
assertEquals(contextObject, contextAfterMessaging);
   }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:ContextObjectMessagingTest.java

示例3: testCallingQueueAsnyc

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
public void testCallingQueueAsnyc() throws Exception {
    KSBTestUtils.setMessagingToAsync();
    // Execute this 100 times, previously when only running a single iteration, this test would pass most of the
    // time but then would occasionally fail, it was possible to reproduce the failure every time by adding
    // these iterations, this allowed us to fix the underlying problem (an issue with KSB callbacks)
    for (int i = 0; i < 100; i++) {
        LOG.info("testCallingQueueAsnyc, iteration: " + i);
        QName serviceName = new QName("testAppsSharedQueue", "sharedQueue");
        SimpleCallback callback = new SimpleCallback();
        KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, callback);
        synchronized (callback) {
            testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
            callback.waitForAsyncCall();
        }
        verifyServiceCalls(serviceName);
        KSBServiceLocator.getBAMService().clearBAMTables();
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:20,代码来源:DistributedQueueTest.java

示例4: testAsyncJavaCall

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
   public void testAsyncJavaCall() throws Exception {
    KSBTestUtils.setMessagingToAsync();
	
	QName serviceName = new QName("TestCl1", "testJavaAsyncService");
	SimpleCallback callback = new SimpleCallback();
KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper()
	.getServiceAsynchronously(serviceName, callback);
    synchronized (callback) {
        testJavaAsyncService.invoke(new MessagingTestObject("message content"));
        callback.waitForAsyncCall();
    }
	verifyServiceCalls(serviceName);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:15,代码来源:SimpleServiceCallTest.java

示例5: testSuccessfullyCallingSyncTopics

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
public void testSuccessfullyCallingSyncTopics() throws Exception {
	
	KsbApiServiceLocator.getServiceBus().synchronize();
	QName serviceName = new QName("testAppsSharedTopic", "sharedTopic");
	
	KSBJavaService testJavaAsyncService = KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName);
	testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
	
	assertTrue("Test harness topic never called", (ServiceCallInformationHolder.flags.get("TestHarnessCalled")).booleanValue());
	assertTrue("Client1 app topic never called", (ServiceCallInformationHolder.flags.get("Client1Called")).booleanValue());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:13,代码来源:DistributedTopicTest.java

示例6: testCallingAsyncTopics

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test public void testCallingAsyncTopics() throws Exception {
    	KSBTestUtils.setMessagingToAsync();
	
	QName serviceName = new QName("testAppsSharedTopic", "sharedTopic");
	
	SimpleCallback simpleCallback = new SimpleCallback();
	KSBJavaService testJavaAsyncService = KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, simpleCallback);
	synchronized (simpleCallback) {
	    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
	    simpleCallback.waitForAsyncCall();
	}
	//because topic invocation doesn't happen in the message service invoker like it should this wait is really on half the answer.  We need to wait long and poll 
	//to determine if the client1 has been called.
	
	int i = 0;
	while (i < 100) {
	    if (ServiceCallInformationHolder.flags.get("Client1Called") != null) {
		break;
	    }
	    Thread.sleep(1000);
	    i++;
	}

	assertTrue("Test harness topic never called", (ServiceCallInformationHolder.flags.get("TestHarnessCalled")).booleanValue());
	assertTrue("Client1 app topic never called", (ServiceCallInformationHolder.flags.get("Client1Called"))
               .booleanValue());

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:29,代码来源:DistributedTopicTest.java

示例7: testDelayedAsynchronousServiceCall

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test public void testDelayedAsynchronousServiceCall() throws Exception {
    KSBTestUtils.setMessagingToAsync();

    QName serviceName = new QName("testAppsSharedQueue", "sharedQueue");

    // Queue up the service to be called asynchronously after 5 seconds
    KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, "context", "value1", "value2", 5000);
	testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
    verifyServiceCalls(serviceName, false);

    // sleep for 1 second, should not have been called
    Thread.sleep(1000);
    verifyServiceCalls(serviceName, false);

    // sleep for 1 second, should not have been called
    Thread.sleep(1000);
    verifyServiceCalls(serviceName, false);

    // sleep for 1 second, should not have been called
    Thread.sleep(1000);
    verifyServiceCalls(serviceName, false);

    Thread.sleep(1000);
    verifyServiceCalls(serviceName, false);

    // TODO this isn't the best test ever because it's relying on waits and timing which is most likely doomed to occasional
    // failure in the CI environment.  If this occurs than I may need to yank this.  A better long term solution would be
    // to allow for the use of callbacks for delayed asynchronous services but that's not something I wanted to try
    // to tackle at the moment

    // now sleep for 3 more seconds, the call should be invoked
    Thread.sleep(3000);
    verifyServiceCalls(serviceName, true);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:36,代码来源:DelayedAsynchronousServiceTest.java

示例8: testSuccessfullyCallingQueueOnce

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
/**
 * If calling a queue with multiple subscribers only one subscriber should be called.
 * 
 * @throws Exception
 */
@Test
public void testSuccessfullyCallingQueueOnce() throws Exception {
    QName serviceName = new QName("testAppsSharedQueue", "sharedQueue");
    KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName);
    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
    verifyServiceCalls(serviceName);

}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:14,代码来源:DistributedQueueTest.java

示例9: testTimeToLive

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
/**
 * test that service is in queue marked 'E' when the time to live is expired.
 * @throws Exception
 */
@Test public void testTimeToLive() throws Exception {

	KSBJavaService explodingQueue = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(this.queueTimeToLiveServiceName);
	explodingQueue.invoke("");
	TestUtilities.waitForExceptionRouting();
	//this service is on a 3 second wait the queue is on a 1 sec.
	Thread.sleep(10000);

	//verify the entry is in exception routing
	List<PersistedMessageBO> messagesQueued = KSBServiceLocator.getMessageQueueService().findByServiceName(this.queueTimeToLiveServiceName, "invoke");
	PersistedMessageBO message = messagesQueued.get(0);
	assertEquals("Message should be in exception status", KSBConstants.ROUTE_QUEUE_EXCEPTION, message.getQueueStatus());
	assertTrue("Message expiration date should be equal to or earlier than last queue date", message.getExpirationDate().getTime() <= message.getQueueDate().getTime());
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:19,代码来源:ExceptionMessagingTest.java

示例10: testCallingQueueAsnyc

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test public void testCallingQueueAsnyc() throws Exception {
    KSBTestUtils.setMessagingToAsync();
    ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.Config.MESSAGING_OFF, "true");

    QName serviceName = QName.valueOf("{testAppsSharedTopic}sharedTopic");
    String value1 = "value1";
    String value2 = "value2";
    KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, null, value1, value2);
    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));

    PersistedMessageBO message = KSBServiceLocator.getMessageQueueService().getNextDocuments(null).get(0);
    assertEquals("value1 incorrectly saved", value1, message.getValue1());
    assertEquals("value2 incorrectly saved", value2, message.getValue2());
	
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:Value1AndValue2PersistedOnMessageCallTest.java

示例11: testStartTheBus

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
public void testStartTheBus() {
	QName serviceName = new QName("TestCl1", "testJavaAsyncService");
	
	KsbApiServiceLocator.getServiceBus().synchronize();
	
	KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName);
	testJavaAsyncService.invoke(new MessagingTestObject("message content"));
	
	// verifyServiceCalls(serviceName);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:12,代码来源:StartBusTest.java

示例12: testSuccessfullyCallingSyncTopics

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test
public void testSuccessfullyCallingSyncTopics() throws Exception {
	
	KsbApiServiceLocator.getServiceBus().synchronize();
	QName serviceName = new QName("testAppsSharedTopic", "sharedTopic");
	
	KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName);
	testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
	
	assertTrue("Test harness topic never called", ((Boolean)ServiceCallInformationHolder.stuff.get("TestHarnessCalled")).booleanValue());
	assertTrue("Client1 app topic never called", ((Boolean)ServiceCallInformationHolder.stuff.get("Client1Called")).booleanValue());
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:13,代码来源:DistributedTopicTest.java

示例13: testCallingAsyncTopics

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test public void testCallingAsyncTopics() throws Exception {
    	KSBTestUtils.setMessagingToAsync();
	
	QName serviceName = new QName("testAppsSharedTopic", "sharedTopic");
	
	SimpleCallback simpleCallback = new SimpleCallback();
	KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, simpleCallback);
	synchronized (simpleCallback) {
	    testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
	    simpleCallback.waitForAsyncCall();
	}
	//because topic invocation doesn't happen in the message service invoker like it should this wait is really on half the answer.  We need to wait long and poll 
	//to determine if the client1 has been called.
	
	int i = 0;
	while (i < 100) {
	    if (ServiceCallInformationHolder.stuff.get("Client1Called") != null) {
		break;
	    }
	    Thread.sleep(1000);
	    i++;
	}

	assertTrue("Test harness topic never called", ((Boolean)ServiceCallInformationHolder.stuff.get("TestHarnessCalled")).booleanValue());
	assertTrue("Client1 app topic never called", ((Boolean)ServiceCallInformationHolder.stuff.get("Client1Called")).booleanValue());

}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:28,代码来源:DistributedTopicTest.java

示例14: testCallingQueueAsnyc

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
@Test public void testCallingQueueAsnyc() throws Exception {
KSBTestUtils.setMessagingToAsync();
ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.Config.MESSAGING_OFF, "true");

QName serviceName = QName.valueOf("{testAppsSharedTopic}sharedTopic");
String value1 = "value1";
String value2 = "value2";
KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, null, value1, value2);
testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));

PersistedMessageBO message = KSBServiceLocator.getMessageQueueService().getNextDocuments(null).get(0);
assertEquals("value1 incorrectly saved", value1, message.getValue1());
assertEquals("value2 incorrectly saved", value2, message.getValue2());

   }
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:16,代码来源:Value1AndValue2PersistedOnMessageCall.java

示例15: testFinalDocumentExceptionRoutingRecovery

import org.kuali.rice.ksb.messaging.service.KSBJavaService; //导入方法依赖的package包/类
/**
 * Tests that a FINAL document can go into exception routing and recover
 * properly while only calling the PROCESSED and FINAL callbacks once.
 */
@Test public void testFinalDocumentExceptionRoutingRecovery() throws Exception {

	// route the document to final
	WorkflowDocument document = WorkflowDocumentFactory.createDocument(getPrincipalIdForName("ewestfal"), "SimpleDocType");
	document.route("");
	assertTrue("Document should be final.", document.isFinal());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);

	// now queue up an exploder which should push the document into
	// exception routing
	JavaServiceDefinition serviceDef = new JavaServiceDefinition();
	serviceDef.setPriority(new Integer(1));
	serviceDef.setQueue(true);
	serviceDef.setRetryAttempts(0);
	serviceDef.setServiceInterface(KSBJavaService.class.getName());
	serviceDef.setServiceName(new QName("KEW", "exploader"));
	serviceDef.setService(new ImTheExploderProcessor());

	serviceDef.setMessageExceptionHandler(DocumentMessageExceptionHandler.class.getName());
	serviceDef.validate();
	KsbApiServiceLocator.getServiceBus().publishService(serviceDef, true);

       DocumentRouteHeaderValue routeHeader = KEWServiceLocator.getRouteHeaderService().getRouteHeader(document.getDocumentId());
       String applicationId = routeHeader.getDocumentType().getApplicationId();

       KSBJavaService exploderAsService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(new QName(
               "KEW", "exploader"), null, null, routeHeader.getDocumentId(), null);
       exploderAsService.invoke("");
	TestUtilities.waitForExceptionRouting();

	// the document should be in exception routing now
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	assertTrue("Document should be in exception routing.", document.isException());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);

	assertTrue("ewestfal should have a complete request.", document.isCompletionRequested());
	document.complete("");

	// the document should be final once again
	document = WorkflowDocumentFactory.loadDocument(getPrincipalIdForName("ewestfal"), document.getDocumentId());
	assertTrue("Document should be final.", document.isFinal());
	assertEquals(1, TestPostProcessor.processedCount);
	assertEquals(1, TestPostProcessor.finalCount);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:51,代码来源:StandardWorkflowEngineTest.java


注:本文中的org.kuali.rice.ksb.messaging.service.KSBJavaService.invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。