@Test public void testEqual() { RequestPolicy privacyPolicy1 = null; RequestPolicy privacyPolicy2 = null; Action notPrivacyPolicy = null; assertTrue("Same null privacy policy should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy1)); assertTrue("Null privacy policies should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy2)); assertTrue("Null privacy policy and null object should be equal", RequestPolicyUtils.equal(privacyPolicy1, notPrivacyPolicy)); privacyPolicy1 = new RequestPolicy(); privacyPolicy2 = new RequestPolicy(); notPrivacyPolicy = new Action(); assertTrue("Same empty privacy policy should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy1)); assertTrue("Empty privacy policies should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy2)); assertTrue("Empty privacy policies should be equal (inverse)", RequestPolicyUtils.equal(privacyPolicy2, privacyPolicy1)); assertFalse("Empty privacy policy and empty object should not be equal", RequestPolicyUtils.equal(privacyPolicy1, notPrivacyPolicy)); RequestorBean requestor = RequestorUtils.create("emma.ict-societies.local", "cis-test.ict-societies.local"); 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")); privacyPolicy1 = RequestPolicyUtils.createList(requestor, RequestItemUtils.create(ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ACTION), ActionUtils.createList(ActionConstants.READ), conditions1), RequestItemUtils.create(ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES), ActionUtils.createList(ActionConstants.READ), conditions2) ); assertTrue("Same privacy policy should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy1)); assertFalse("Different privacy policies should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy2)); assertFalse("Different privacy policies should be equal (inverse)", RequestPolicyUtils.equal(privacyPolicy2, privacyPolicy1)); privacyPolicy2 = RequestPolicyUtils.createList(requestor, RequestItemUtils.create(ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ACTION), ActionUtils.createList(ActionConstants.READ), conditions1) ); assertFalse("Different privacy policies should be equal (2)", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy2)); assertFalse("Different privacy policies should be equal (inverse) (2)", RequestPolicyUtils.equal(privacyPolicy2, privacyPolicy1)); privacyPolicy2 = RequestPolicyUtils.createList(requestor, RequestItemUtils.create(ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.ACTION), ActionUtils.createList(ActionConstants.READ), conditions1), RequestItemUtils.create(ResourceUtils.create(DataIdentifierScheme.CONTEXT, CtxAttributeTypes.LOCATION_COORDINATES), ActionUtils.createList(ActionConstants.READ), conditions2) ); assertTrue("Equal privacy policies should be equal", RequestPolicyUtils.equal(privacyPolicy1, privacyPolicy2)); assertTrue("Equal privacy policies should be equal (inverse)", RequestPolicyUtils.equal(privacyPolicy2, privacyPolicy1)); assertFalse("Privacy policy and object should not be equal", RequestPolicyUtils.equal(privacyPolicy1, notPrivacyPolicy)); }
public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy 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.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return (RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor()) ); }
RequestPolicyUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy 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.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return (RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor()) ); } }
RequestPolicyUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy 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.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return (RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor()) ); }  }
RequestPolicyUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy 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.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return (RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor()) ); }  static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy create(PrivacyPolicyTypeConstants privacyPolicyType, RequestorBean requestor, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem> requestItems); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy create(RequestorBean requestor, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem> requestItems); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy createList(RequestorBean requestor, org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem... requestItems); static String toXmlString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicy); static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy o1, Object o2); @Deprecated static boolean equals(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy o1, Object o2); static boolean equal(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> o1, Object o2); static boolean contain(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy needle, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> haystack); @Deprecated static List<String> getDataTypes(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy privacyPolicy); @Deprecated static List<String> getDataTypes(DataIdentifierScheme schemeFilter, org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy privacyPolicy); static RequestPolicy toRequestPolicy(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicyBean, IIdentityManager identityManager); static List<RequestPolicy> toRequestPolicys(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> requestPolicyBeans, IIdentityManager identityManager); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy toRequestPolicyBean(RequestPolicy requestPolicy); static List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> toRequestPolicyBeans(List<RequestPolicy> requestPolicys); }
RequestPolicyUtils { public static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy 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.RequestPolicy ro2 = (org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy) o2; return (RequestItemUtils.equal(o1.getRequestItems(), ro2.getRequestItems()) && RequestorUtils.equal(o1.getRequestor(), ro2.getRequestor()) ); }  static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy create(PrivacyPolicyTypeConstants privacyPolicyType, RequestorBean requestor, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem> requestItems); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy create(RequestorBean requestor, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem> requestItems); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy createList(RequestorBean requestor, org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestItem... requestItems); static String toXmlString(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicy); static boolean equal(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy o1, Object o2); @Deprecated static boolean equals(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy o1, Object o2); static boolean equal(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> o1, Object o2); static boolean contain(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy needle, List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> haystack); @Deprecated static List<String> getDataTypes(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy privacyPolicy); @Deprecated static List<String> getDataTypes(DataIdentifierScheme schemeFilter, org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy privacyPolicy); static RequestPolicy toRequestPolicy(org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy requestPolicyBean, IIdentityManager identityManager); static List<RequestPolicy> toRequestPolicys(List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> requestPolicyBeans, IIdentityManager identityManager); static org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy toRequestPolicyBean(RequestPolicy requestPolicy); static List<org.societies.api.schema.privacytrust.privacy.model.privacypolicy.RequestPolicy> toRequestPolicyBeans(List<RequestPolicy> requestPolicys);  }