View Javadoc

1   /*
2    * Copyright 2007 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.messaging;
17  
18  import javax.xml.namespace.QName;
19  
20  import org.junit.Test;
21  import org.kuali.rice.core.config.ConfigContext;
22  import org.kuali.rice.ksb.messaging.PersistedMessage;
23  import org.kuali.rice.ksb.messaging.service.KSBJavaService;
24  import org.kuali.rice.ksb.service.KSBServiceLocator;
25  import org.kuali.rice.ksb.test.KSBTestCase;
26  import org.kuali.rice.ksb.util.KSBConstants;
27  
28  /**
29   * verify that value1 and value2 are preserved when passed into message helper and making an async call.  
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   *
33   */
34  public class Value1AndValue2PersistedOnMessageCall extends KSBTestCase {
35      
36      @Test public void testCallingQueueAsnyc() throws Exception {
37  	KSBTestUtils.setMessagingToAsync();
38  	ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.MESSAGING_OFF, "true");
39  	
40  	QName serviceName = QName.valueOf("{testAppsSharedTopic}sharedTopic");
41  	String value1 = "value1";
42  	String value2 = "value2";
43  	KSBJavaService testJavaAsyncService = (KSBJavaService) KSBServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, null, value1, value2);
44  	testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false));
45  	
46  	PersistedMessage message = KSBServiceLocator.getRouteQueueService().getNextDocuments(null).get(0);
47  	assertEquals("value1 incorrectly saved", value1, message.getValue1());
48  	assertEquals("value2 incorrectly saved", value2, message.getValue2());
49  	
50      }
51  
52  }