@Test public void testPolicy() { System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "xacml.pap.properties"); PolicyRestAdapter adapter = Mockito.mock(PolicyRestAdapter.class); Policy policy = new ConfigPolicy(adapter); Path path = Paths.get("src/test/resources"); policy.setFinalPolicyPath(path); assertEquals(path, policy.getFinalPolicyPath()); assertNotNull(policy.createMatch("testKey", "testVal")); assertNotNull(policy.createDynamicMatch("testKey", "testVal")); assertNotNull(policy.getNextFilename(path, "Config", "SampleTest1206", 1)); assertNull(policy.getNextLoopFilename(path, "Config", "ClosedLoop_PM", "foo", 1)); assertNull(policy.getNextLoopFilename(path, "Config", "ClosedLoop_Fault", "foo", 1)); assertNull(policy.getNextLoopFilename(path, "Config", "Micro Service", "foo", 1)); assertNull(policy.getNextLoopFilename(path, "Config", "Optimization", "foo", 1)); Object policyData = null; assertEquals(0, policy.createPolicy(null, policyData).size()); policyData = new PolicyType(); assertEquals(1, policy.createPolicy(null, policyData).size()); assertNotNull(Policy.getConfigHome()); assertEquals(true, policy.validateConfigForm()); policy.setPreparedToSave(true); assertEquals(true, policy.isPreparedToSave()); policy.setPolicyExists(true); assertEquals(true, policy.isPolicyExists()); }
public Policy() { CONFIG_HOME = getConfigHome(); ACTION_HOME = getActionHome(); CONFIG_URL = "$URL"; performer.put("PDP", "PDPAction"); performer.put("PEP", "PEPAction"); }
Policy { public Policy() { CONFIG_HOME = getConfigHome(); ACTION_HOME = getActionHome(); CONFIG_URL = "$URL"; performer.put("PDP", "PDPAction"); performer.put("PEP", "PEPAction"); } }
Policy { public Policy() { CONFIG_HOME = getConfigHome(); ACTION_HOME = getActionHome(); CONFIG_URL = "$URL"; performer.put("PDP", "PDPAction"); performer.put("PEP", "PEPAction"); } Policy(); }
Policy { public Policy() { CONFIG_HOME = getConfigHome(); ACTION_HOME = getActionHome(); CONFIG_URL = "$URL"; performer.put("PDP", "PDPAction"); performer.put("PEP", "PEPAction"); } Policy(); Path getFinalPolicyPath(); void setFinalPolicyPath(Path finalPolicyPath); abstract Object getCorrectPolicyDataObject(); abstract Map<String, String> savePolicies(); abstract boolean prepareToSave(); static String getConfigHome(); static String getActionHome(); boolean validateConfigForm(); boolean isPreparedToSave(); boolean isPolicyExists(); void setPolicyExists(boolean policyExists); }
Policy { public Policy() { CONFIG_HOME = getConfigHome(); ACTION_HOME = getActionHome(); CONFIG_URL = "$URL"; performer.put("PDP", "PDPAction"); performer.put("PEP", "PEPAction"); } Policy(); Path getFinalPolicyPath(); void setFinalPolicyPath(Path finalPolicyPath); abstract Object getCorrectPolicyDataObject(); abstract Map<String, String> savePolicies(); abstract boolean prepareToSave(); static String getConfigHome(); static String getActionHome(); boolean validateConfigForm(); boolean isPreparedToSave(); boolean isPolicyExists(); void setPolicyExists(boolean policyExists); static final String GET_INT_TYPE; static final String GET_STRING_TYPE; static final String ONAPID; static final String CONFIGID; static final String CLOSEDLOOPID; static final String CONFIG_POLICY; static final String ACTION_POLICY; static final String DECISION_POLICY; static final String CATEGORY_RECIPIENT_SUBJECT; static final String CATEGORY_RESOURCE; static final String CATEGORY_ACTION; static final String CATEGORY_ACCESS_SUBJECT; static final String ACTION_ID; static final String SUBJECT_ID; static final String RESOURCE_ID; static final String FUNTION_INTEGER_ONE_AND_ONLY; static final String FUNCTION_STRING_ONE_AND_ONLY; static final String FUNCTION_BOOLEAN_ONE_AND_ONLY; static final String FUNCTION_STRING_EQUAL; static final String FUNCTION_STRING_REGEX_MATCH; static final String FUNCTION_STRING_REGEXP_MATCH; static final String FUNCTION_STRING_EQUAL_IGNORE; static final String INTEGER_DATATYPE; static final String BOOLEAN_DATATYPE; static final String STRING_DATATYPE; static final String URI_DATATYPE; static final String RULE_VARIABLE; static final String EMPTY_STRING; public PolicyRestAdapter policyAdapter; }