/*
 * Copyright to the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.rioproject.opstring;

import org.junit.Test;
import org.rioproject.sla.ServiceLevelAgreements;

import java.util.HashMap;

/**
 * Test ServiceElement
 */
public class ServiceElementTest {
    @Test
    public void testEquality() {
        ServiceBeanConfig sbc = new ServiceBeanConfig(new HashMap<String, Object>(), new String[]{"-"});
        ClassBundle export1 = new ClassBundle("org.rioproject.resources.servicecore.Service");
        export1.addJAR("rio-api.jar");
        export1.addJAR("service-dl.jar");
        export1.setCodebase("http://10.1.1.3:9000");
        ClassBundle impl = new ClassBundle("com.foo.ExampleImpl");
        impl.addJAR("rio.jar");
        impl.addJAR("service.jar");
        impl.setCodebase("http://10.1.1.3:9000");
        String fdh = "org.rioproject.fdh.LeaseFaultDetectionHandler";
        ServiceElement s1 = new ServiceElement(ServiceElement.ProvisionType.DYNAMIC,
                                               sbc,
                                               new ServiceLevelAgreements(),
                                               new ClassBundle[]{export1},
                                               new ClassBundle(fdh),
                                               impl);

        ClassBundle export2 =
            new ClassBundle("org.rioproject.resources.servicecore.Service");
        export2.addJAR("rio-api.jar");
        export2.addJAR("service-dl.jar");
        export2.setCodebase("http://10.1.1.3:9000");
        ServiceElement s2 = new ServiceElement(ServiceElement.ProvisionType.DYNAMIC,
                                               sbc,
                                               new ServiceLevelAgreements(),
                                               new ClassBundle[]{export2},
                                               new ClassBundle(fdh),
                                               impl);
        System.out.println("s1 equal s2 ? " + s1.equals(s2));
        System.out.println("s2 equal s1 ? " + s2.equals(s1));
        System.out.println("s1 equal s1 ? " + s1.equals(s1));
        System.out.println("s2 equal s2 ? " + s2.equals(s2));
        System.out.println("s1 hash : " + s1.hashCode());
        System.out.println("s2 hash : " + s2.hashCode());
    }
}

@@ -641,16 +641,47 @@
 tring;%0A%0A
+import junit.framework.Assert;%0A
 import o
@@ -1912,28 +1912,16 @@
 xport2 =
-%0A           
  new Cla
@@ -2532,34 +2532,33 @@
         
-System.out.println
+Assert.assertTrue
 (%22s1 equ
@@ -2562,26 +2562,25 @@
 equal s2 ? %22
- +
+,
  s1.equals(s
@@ -2592,34 +2592,33 @@
         
-System.out.println
+Assert.assertTrue
 (%22s2 equ
@@ -2622,26 +2622,25 @@
 equal s1 ? %22
- +
+,
  s2.equals(s
@@ -2652,34 +2652,33 @@
         
-System.out.println
+Assert.assertTrue
 (%22s1 equ
@@ -2686,18 +2686,17 @@
 l s1 ? %22
- +
+,
  s1.equa
@@ -2712,34 +2712,33 @@
         
-System.out.println
+Assert.assertTrue
 (%22s2 equ
@@ -2746,18 +2746,17 @@
 l s2 ? %22
- +
+,
  s2.equa
@@ -2768,124 +2768,8 @@
 ));%0A
-        System.out.println(%22s1 hash : %22 + s1.hashCode());%0A        System.out.println(%22s2 hash : %22 + s2.hashCode());%0A
     

Add asserts