001 /** 002 * Copyright 2005-2011 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.ksb.messaging; 017 018 import static org.junit.Assert.assertEquals; 019 020 import javax.xml.namespace.QName; 021 022 import org.junit.Test; 023 import org.kuali.rice.core.api.config.property.ConfigContext; 024 import org.kuali.rice.ksb.api.KsbApiServiceLocator; 025 import org.kuali.rice.ksb.messaging.service.KSBJavaService; 026 import org.kuali.rice.ksb.service.KSBServiceLocator; 027 import org.kuali.rice.ksb.test.KSBTestCase; 028 import org.kuali.rice.ksb.util.KSBConstants; 029 030 /** 031 * verify that value1 and value2 are preserved when passed into message helper and making an async call. 032 * 033 * @author Kuali Rice Team (rice.collab@kuali.org) 034 * 035 */ 036 public class Value1AndValue2PersistedOnMessageCall extends KSBTestCase { 037 038 @Test public void testCallingQueueAsnyc() throws Exception { 039 KSBTestUtils.setMessagingToAsync(); 040 ConfigContext.getCurrentContextConfig().putProperty(KSBConstants.Config.MESSAGING_OFF, "true"); 041 042 QName serviceName = QName.valueOf("{testAppsSharedTopic}sharedTopic"); 043 String value1 = "value1"; 044 String value2 = "value2"; 045 KSBJavaService testJavaAsyncService = (KSBJavaService) KsbApiServiceLocator.getMessageHelper().getServiceAsynchronously(serviceName, null, null, value1, value2); 046 testJavaAsyncService.invoke(new ClientAppServiceSharedPayloadObj("message content", false)); 047 048 PersistedMessageBO message = KSBServiceLocator.getMessageQueueService().getNextDocuments(null).get(0); 049 assertEquals("value1 incorrectly saved", value1, message.getValue1()); 050 assertEquals("value2 incorrectly saved", value2, message.getValue2()); 051 052 } 053 054 }