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.kim.test.service;
017
018 import org.junit.Ignore;
019 import org.kuali.rice.core.api.config.property.ConfigContext;
020 import org.kuali.rice.kim.api.KimApiConstants;
021 import org.kuali.rice.ksb.api.KsbApiServiceLocator;
022 import org.kuali.rice.ksb.api.bus.Endpoint;
023 import org.kuali.rice.ksb.api.bus.ServiceBus;
024 import org.kuali.rice.test.BaselineTestCase;
025
026 import javax.xml.namespace.QName;
027 import java.util.List;
028
029 import static org.junit.Assert.fail;
030
031 /**
032 * Test the GroupService via remote calls
033 *
034 * @author Kuali Rice Team (kuali-rice@googlegroups.com)
035 *
036 */
037 @BaselineTestCase.BaselineMode(BaselineTestCase.Mode.ROLLBACK_CLEAR_DB)
038 public class GroupServiceRemoteTest extends GroupServiceTest {
039
040 public void setUp() throws Exception {
041 super.setUp();
042 }
043
044 /*@Override
045 protected Lifecycle getLoadApplicationLifecycle() {
046 return getJettyServerLifecycle();
047 } */
048
049 private int getConfigIntProp(String intPropKey) {
050 return Integer.parseInt(getConfigProp(intPropKey));
051 }
052
053 private String getConfigProp(String propKey) {
054 return ConfigContext.getCurrentContextConfig().getProperty(propKey);
055 }
056
057 /**
058 * This method tries to get a client proxy for the specified KIM service
059 *
060 * @param svcName - name of the KIM service desired
061 * @return the proxy object
062 * @throws Exception
063 */
064 protected Object getKimService(String svcName) throws Exception {
065 ServiceBus serviceBus = KsbApiServiceLocator.getServiceBus();
066 List<Endpoint> endpoints = serviceBus.getRemoteEndpoints(new QName(KimApiConstants.Namespaces.KIM_NAMESPACE_2_0, svcName));
067 if (endpoints.size() > 1) {
068 fail("Found more than one RemotedServiceHolder for " + svcName);
069 }
070 Endpoint endpoint = endpoints.get(0);
071 return endpoint.getService();
072 }
073 }