@Test public void testEquality() { ServiceBeanConfig sbc = new ServiceBeanConfig(new HashMap<String, Object>(), new String[]{"-"}); ClassBundle export1 = new ClassBundle("org.rioproject.service.Service"); export1.addJAR("rio-api.jar"); export1.addJAR("service-dl.jar"); export1.setCodebase("http: ClassBundle impl = new ClassBundle("com.foo.ExampleImpl"); impl.addJAR("rio.jar"); impl.addJAR("service.jar"); impl.setCodebase("http: String fdh = "org.rioproject.impl.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.service.Service"); export2.addJAR("rio-api.jar"); export2.addJAR("service-dl.jar"); export2.setCodebase("http: ServiceElement s2 = new ServiceElement(ServiceElement.ProvisionType.DYNAMIC, sbc, new ServiceLevelAgreements(), new ClassBundle[]{export2}, new ClassBundle(fdh), impl); Assert.assertTrue("s1 equal s2 ? ", s1.equals(s2)); Assert.assertTrue("s2 equal s1 ? ", s2.equals(s1)); Assert.assertTrue("s1 equal s1 ? ", s1.equals(s1)); Assert.assertTrue("s2 equal s2 ? ", s2.equals(s2)); }
public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServiceElement)) { return false; } ServiceElement that = (ServiceElement)obj; if (this.getName().equals(that.getName()) && this.getOperationalStringName().equals(that.getOperationalStringName())) { if (this.exportBundles.length != that.exportBundles.length) { return false; } for (ClassBundle exportBundle1 : this.exportBundles) { boolean matched = false; for (ClassBundle exportBundle : that.exportBundles) { if (exportBundle1.equals(exportBundle)) { matched = true; break; } } if (!matched) { return false; } } if (this.componentBundle==null && that.componentBundle == null) return true; if (this.componentBundle!=null && that.componentBundle != null) { return this.componentBundle.equals(that.componentBundle); } } return false; }
ServiceElement implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServiceElement)) { return false; } ServiceElement that = (ServiceElement)obj; if (this.getName().equals(that.getName()) && this.getOperationalStringName().equals(that.getOperationalStringName())) { if (this.exportBundles.length != that.exportBundles.length) { return false; } for (ClassBundle exportBundle1 : this.exportBundles) { boolean matched = false; for (ClassBundle exportBundle : that.exportBundles) { if (exportBundle1.equals(exportBundle)) { matched = true; break; } } if (!matched) { return false; } } if (this.componentBundle==null && that.componentBundle == null) return true; if (this.componentBundle!=null && that.componentBundle != null) { return this.componentBundle.equals(that.componentBundle); } } return false; } }
ServiceElement implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServiceElement)) { return false; } ServiceElement that = (ServiceElement)obj; if (this.getName().equals(that.getName()) && this.getOperationalStringName().equals(that.getOperationalStringName())) { if (this.exportBundles.length != that.exportBundles.length) { return false; } for (ClassBundle exportBundle1 : this.exportBundles) { boolean matched = false; for (ClassBundle exportBundle : that.exportBundles) { if (exportBundle1.equals(exportBundle)) { matched = true; break; } } if (!matched) { return false; } } if (this.componentBundle==null && that.componentBundle == null) return true; if (this.componentBundle!=null && that.componentBundle != null) { return this.componentBundle.equals(that.componentBundle); } } return false; } ServiceElement();  ServiceElement(ProvisionType provisionType);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports,
                          /* Optional args */
                          ClassBundle fdhBundle,
                          ClassBundle componentBundle); }
ServiceElement implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServiceElement)) { return false; } ServiceElement that = (ServiceElement)obj; if (this.getName().equals(that.getName()) && this.getOperationalStringName().equals(that.getOperationalStringName())) { if (this.exportBundles.length != that.exportBundles.length) { return false; } for (ClassBundle exportBundle1 : this.exportBundles) { boolean matched = false; for (ClassBundle exportBundle : that.exportBundles) { if (exportBundle1.equals(exportBundle)) { matched = true; break; } } if (!matched) { return false; } } if (this.componentBundle==null && that.componentBundle == null) return true; if (this.componentBundle!=null && that.componentBundle != null) { return this.componentBundle.equals(that.componentBundle); } } return false; } ServiceElement();  ServiceElement(ProvisionType provisionType);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports,
                          /* Optional args */
                          ClassBundle fdhBundle,
                          ClassBundle componentBundle); void setProvisionType(ProvisionType provisionType); ProvisionType getProvisionType(); String getName(); void setPlanned(int planned); void incrementPlanned(); void decrementPlanned(); int getPlanned(); void setActual(int actual); int getActual(); void setMaxPerMachine(int maxPerMachine); int getMaxPerMachine(); void setMachineBoundary(MachineBoundary boundary); MachineBoundary getMachineBoundary(); void setCluster(String... machineCluster); String[] getCluster(); void setFaultDetectionHandlerBundle(ClassBundle fdhBundle); ClassBundle getFaultDetectionHandlerBundle(); void setServiceBeanConfig(ServiceBeanConfig sbConfig); ServiceBeanConfig getServiceBeanConfig(); String getOperationalStringName(); void setOperationalStringName(String name); void setAutoAdvertise(boolean autoAdvertise); boolean getAutoAdvertise(); void setDiscoveryManagementPooling(boolean discoPool); boolean getDiscoveryManagementPooling(); void setMatchOnName(boolean matchOnName); boolean getMatchOnName(); void setComponentBundle(ClassBundle componentBundle); ClassBundle getComponentBundle(); void setExportBundles(ClassBundle... exports); ClassBundle[] getExportBundles(); URL[] getExportURLs(); void setServiceLevelAgreements(ServiceLevelAgreements slaAgreements); ServiceLevelAgreements getServiceLevelAgreements(); void setAssociationDescriptors(AssociationDescriptor... associationDescriptors); void addAssociationDescriptors(AssociationDescriptor... associationDescriptors); AssociationDescriptor[] getAssociationDescriptors(); void setProvisionablePlatformCapabilities(Collection<SystemComponent> downloadableCapabilities); Collection<SystemComponent> getProvisionablePlatformCapabilities(); ExecDescriptor getExecDescriptor(); void setExecDescriptor(ExecDescriptor execDescriptor); void setStagedData(StagedData... stagedData); StagedData[] getStagedData(); boolean forkService(); void setFork(boolean fork); RemoteRepository[] getRemoteRepositories(); void setRemoteRepositories(Collection<RemoteRepository> remoteRepositories); List<RuleMap> getRuleMaps(); void setRuleMaps(Collection<RuleMap> ruleMaps); int hashCode(); boolean equals(Object obj); @Override String toString(); }
ServiceElement implements Serializable { public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServiceElement)) { return false; } ServiceElement that = (ServiceElement)obj; if (this.getName().equals(that.getName()) && this.getOperationalStringName().equals(that.getOperationalStringName())) { if (this.exportBundles.length != that.exportBundles.length) { return false; } for (ClassBundle exportBundle1 : this.exportBundles) { boolean matched = false; for (ClassBundle exportBundle : that.exportBundles) { if (exportBundle1.equals(exportBundle)) { matched = true; break; } } if (!matched) { return false; } } if (this.componentBundle==null && that.componentBundle == null) return true; if (this.componentBundle!=null && that.componentBundle != null) { return this.componentBundle.equals(that.componentBundle); } } return false; } ServiceElement();  ServiceElement(ProvisionType provisionType);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports);  ServiceElement(ProvisionType provisionType,
                          ServiceBeanConfig sbConfig,
                          ServiceLevelAgreements slAgreements,
                          ClassBundle[] exports,
                          /* Optional args */
                          ClassBundle fdhBundle,
                          ClassBundle componentBundle); void setProvisionType(ProvisionType provisionType); ProvisionType getProvisionType(); String getName(); void setPlanned(int planned); void incrementPlanned(); void decrementPlanned(); int getPlanned(); void setActual(int actual); int getActual(); void setMaxPerMachine(int maxPerMachine); int getMaxPerMachine(); void setMachineBoundary(MachineBoundary boundary); MachineBoundary getMachineBoundary(); void setCluster(String... machineCluster); String[] getCluster(); void setFaultDetectionHandlerBundle(ClassBundle fdhBundle); ClassBundle getFaultDetectionHandlerBundle(); void setServiceBeanConfig(ServiceBeanConfig sbConfig); ServiceBeanConfig getServiceBeanConfig(); String getOperationalStringName(); void setOperationalStringName(String name); void setAutoAdvertise(boolean autoAdvertise); boolean getAutoAdvertise(); void setDiscoveryManagementPooling(boolean discoPool); boolean getDiscoveryManagementPooling(); void setMatchOnName(boolean matchOnName); boolean getMatchOnName(); void setComponentBundle(ClassBundle componentBundle); ClassBundle getComponentBundle(); void setExportBundles(ClassBundle... exports); ClassBundle[] getExportBundles(); URL[] getExportURLs(); void setServiceLevelAgreements(ServiceLevelAgreements slaAgreements); ServiceLevelAgreements getServiceLevelAgreements(); void setAssociationDescriptors(AssociationDescriptor... associationDescriptors); void addAssociationDescriptors(AssociationDescriptor... associationDescriptors); AssociationDescriptor[] getAssociationDescriptors(); void setProvisionablePlatformCapabilities(Collection<SystemComponent> downloadableCapabilities); Collection<SystemComponent> getProvisionablePlatformCapabilities(); ExecDescriptor getExecDescriptor(); void setExecDescriptor(ExecDescriptor execDescriptor); void setStagedData(StagedData... stagedData); StagedData[] getStagedData(); boolean forkService(); void setFork(boolean fork); RemoteRepository[] getRemoteRepositories(); void setRemoteRepositories(Collection<RemoteRepository> remoteRepositories); List<RuleMap> getRuleMaps(); void setRuleMaps(Collection<RuleMap> ruleMaps); int hashCode(); boolean equals(Object obj); @Override String toString();  }