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 static org.junit.Assert.assertFalse;
19  import static org.junit.Assert.assertTrue;
20  
21  import java.net.URL;
22  import java.util.ArrayList;
23  
24  import org.junit.Test;
25  import org.kuali.rice.ksb.api.bus.support.JavaServiceDefinition;
26  import org.kuali.rice.ksb.api.bus.support.SoapServiceDefinition;
27  import org.kuali.rice.ksb.test.KSBTestCase;
28  
29  /**
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   * @since 0.9
33   *
34   */
35  public class SoapServiceDefinitionTest extends KSBTestCase {
36      
37      private SoapServiceDefinition soapDefinition;
38  
39      public void setUp() throws Exception {
40      	super.setUp();
41          this.soapDefinition = new SoapServiceDefinition();
42          this.soapDefinition.setLocalServiceName("testServiceName");
43          this.soapDefinition.setEndpointUrl(new URL("http://www.rutgers.edu"));
44          this.soapDefinition.setService(new ArrayList<String>());
45          this.soapDefinition.validate();
46      }
47      
48      @Test
49      public void testIsSameSuccessWithSameDefinition() {
50          assertTrue(this.soapDefinition.equals(this.soapDefinition));
51      }
52      
53      @Test
54      public void testIsSameSuccessWithDifferentDefinition() throws Exception {
55          final SoapServiceDefinition soapServiceDefinition = new SoapServiceDefinition();
56          soapServiceDefinition.setLocalServiceName("testServiceName");
57          soapServiceDefinition.setEndpointUrl(new URL("http://www.rutgers.edu"));
58          soapServiceDefinition.setService(new ArrayList<String>());
59          soapServiceDefinition.validate();
60      	
61          assertTrue(this.soapDefinition.equals(soapServiceDefinition));
62      }
63      
64      @Test
65      public void testIsSameFailureWithDifferentClass() throws Exception {
66          final JavaServiceDefinition javaServiceDefinition = new JavaServiceDefinition();
67          javaServiceDefinition.setBusSecurity(Boolean.FALSE);
68          javaServiceDefinition.setLocalServiceName("testServiceName");
69          javaServiceDefinition.setEndpointUrl(new URL("http://www.rutgers.edu"));
70          javaServiceDefinition.setService(new ArrayList<String>());
71          javaServiceDefinition.validate();
72          assertFalse(this.soapDefinition.equals(javaServiceDefinition));
73      }
74  }