@Test public void testEqual() { String testTitle = "Equal"; LOG.info(testTitle); Resource resource1 = null; Resource resource2 = null; Action notResource = null; assertTrue("Same null resource should be equal", ResourceUtils.equal(resource1, resource1)); assertTrue("Null resources should be equal", ResourceUtils.equal(resource1, resource2)); assertTrue("Null resource and null object should be equal", ResourceUtils.equal(resource1, notResource)); resource1 = new Resource(); resource2 = new Resource(); notResource = new Action(); assertTrue("Same empty resource should be equal", ResourceUtils.equal(resource1, resource1)); assertTrue("Empty resources should be equal", ResourceUtils.equal(resource1, resource2)); assertTrue("Empty resources should be equal (inverse)", ResourceUtils.equal(resource2, resource1)); assertFalse("Empty resource and empty object should not be equal", ResourceUtils.equal(resource1, notResource)); List<Condition> conditions1 = new ArrayList<Condition>(); conditions1.add(ConditionUtils.create(ConditionConstants.SHARE_WITH_3RD_PARTIES, "Yes")); List<Condition> conditions2 = new ArrayList<Condition>(); conditions2.add(ConditionUtils.create(ConditionConstants.SHARE_WITH_3RD_PARTIES, "Yes")); conditions2.add(ConditionUtils.create(ConditionConstants.MAY_BE_INFERRED, "Yes")); resource1 = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ACTION); assertTrue("Same resource should be equal", ResourceUtils.equal(resource1, resource1)); assertFalse("Different resources should be equal", ResourceUtils.equal(resource1, resource2)); assertFalse("Different resources should be equal (inverse)", ResourceUtils.equal(resource2, resource1)); resource2 = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ABOUT); assertFalse("Different resources should be equal (2)", ResourceUtils.equal(resource1, resource2)); assertFalse("Different resources should be equal (inverse) (2)", ResourceUtils.equal(resource2, resource1)); resource2 = ResourceUtils.create(DataIdentifierScheme.CONTEXT+": assertFalse("Different resources should be equal (2)", ResourceUtils.equal(resource1, resource2)); assertFalse("Different resources should be equal (inverse) (2)", ResourceUtils.equal(resource2, resource1)); resource2 = ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ACTION); assertTrue("Equal resources should be equal", ResourceUtils.equal(resource1, resource2)); assertTrue("Equal resources should be equal (inverse)", ResourceUtils.equal(resource2, resource1)); assertFalse("resource and object should not be equal", ResourceUtils.equal(resource1, notResource)); }
public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2) { if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource) o2; return (StringUtils.equals(o1.getDataIdUri(), ro2.getDataIdUri()) && StringUtils.equals(o1.getDataType(), ro2.getDataType()) && DataIdentifierSchemeUtils.equal(o1.getScheme(), ro2.getScheme()) ); }
ResourceUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2) { if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource) o2; return (StringUtils.equals(o1.getDataIdUri(), ro2.getDataIdUri()) && StringUtils.equals(o1.getDataType(), ro2.getDataType()) && DataIdentifierSchemeUtils.equal(o1.getScheme(), ro2.getScheme()) ); } }
ResourceUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2) { if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource) o2; return (StringUtils.equals(o1.getDataIdUri(), ro2.getDataIdUri()) && StringUtils.equals(o1.getDataType(), ro2.getDataType()) && DataIdentifierSchemeUtils.equal(o1.getScheme(), ro2.getScheme()) ); }  }
ResourceUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2) { if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource) o2; return (StringUtils.equals(o1.getDataIdUri(), ro2.getDataIdUri()) && StringUtils.equals(o1.getDataType(), ro2.getDataType()) && DataIdentifierSchemeUtils.equal(o1.getScheme(), ro2.getScheme()) ); }  static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(String dataIdUri); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(DataIdentifierScheme dataScheme, String dataType); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(DataIdentifier dataId); static String getDataIdUri(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String getDataType(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static DataIdentifier getDataIdentifier(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toXmlString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toString(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> values); static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2); @Deprecated static boolean equals(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2); static boolean equal(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> o1, Object o2); static boolean contain(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource needle, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> haystack); static Resource toResource(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resourceBean); static List<Resource> toResources(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> resourceBeans); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource toResourceBean(Resource resource); static List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> toResourceBeans(List<Resource> resources); }
ResourceUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2) { if (o1 == o2) { return true; } if (o2 == null) { return false; } if (o1 == null) { return false; } if (o1.getClass() != o2.getClass()) { return false; } org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource) o2; return (StringUtils.equals(o1.getDataIdUri(), ro2.getDataIdUri()) && StringUtils.equals(o1.getDataType(), ro2.getDataType()) && DataIdentifierSchemeUtils.equal(o1.getScheme(), ro2.getScheme()) ); }  static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(String dataIdUri); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(DataIdentifierScheme dataScheme, String dataType); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource create(DataIdentifier dataId); static String getDataIdUri(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String getDataType(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static DataIdentifier getDataIdentifier(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toXmlString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resource); static String toString(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> values); static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2); @Deprecated static boolean equals(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource o1, Object o2); static boolean equal(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> o1, Object o2); static boolean contain(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource needle, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> haystack); static Resource toResource(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource resourceBean); static List<Resource> toResources(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> resourceBeans); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource toResourceBean(Resource resource); static List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.Resource> toResourceBeans(List<Resource> resources);  }