@Test public void getNameScopeAndVersionFromPdpPolicyTest() { String fileName = "com.Decision_testname.1.xml"; String[] expectedArray = new String[3]; expectedArray[0] = "Decision_testname.1.xml"; expectedArray[2] = "1"; expectedArray[1] = "com"; String[] returnArray = d.getNameScopeAndVersionFromPdpPolicy(fileName); Assert.assertArrayEquals(expectedArray, returnArray); }
public String[] getNameScopeAndVersionFromPdpPolicy(String fileName) { String[] splitByDots = fileName.split("\\."); if (splitByDots.length < 3) { return null; } String policyName = splitByDots[splitByDots.length - 3]; String version = splitByDots[splitByDots.length - 2]; String scope = ""; for (int i = 0; i < splitByDots.length - 3; i++) { scope += ".".concat(splitByDots[i]); } if (scope.length() > 0) { scope = scope.substring(1); } String[] returnArray = new String[3]; returnArray[0] = policyName + "." + version + ".xml"; returnArray[2] = version; returnArray[1] = scope; return returnArray; }
PolicyDbDao { public String[] getNameScopeAndVersionFromPdpPolicy(String fileName) { String[] splitByDots = fileName.split("\\."); if (splitByDots.length < 3) { return null; } String policyName = splitByDots[splitByDots.length - 3]; String version = splitByDots[splitByDots.length - 2]; String scope = ""; for (int i = 0; i < splitByDots.length - 3; i++) { scope += ".".concat(splitByDots[i]); } if (scope.length() > 0) { scope = scope.substring(1); } String[] returnArray = new String[3]; returnArray[0] = policyName + "." + version + ".xml"; returnArray[2] = version; returnArray[1] = scope; return returnArray; } }
PolicyDbDao { public String[] getNameScopeAndVersionFromPdpPolicy(String fileName) { String[] splitByDots = fileName.split("\\."); if (splitByDots.length < 3) { return null; } String policyName = splitByDots[splitByDots.length - 3]; String version = splitByDots[splitByDots.length - 2]; String scope = ""; for (int i = 0; i < splitByDots.length - 3; i++) { scope += ".".concat(splitByDots[i]); } if (scope.length() > 0) { scope = scope.substring(1); } String[] returnArray = new String[3]; returnArray[0] = policyName + "." + version + ".xml"; returnArray[2] = version; returnArray[1] = scope; return returnArray; } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); }
PolicyDbDao { public String[] getNameScopeAndVersionFromPdpPolicy(String fileName) { String[] splitByDots = fileName.split("\\."); if (splitByDots.length < 3) { return null; } String policyName = splitByDots[splitByDots.length - 3]; String version = splitByDots[splitByDots.length - 2]; String scope = ""; for (int i = 0; i < splitByDots.length - 3; i++) { scope += ".".concat(splitByDots[i]); } if (scope.length() > 0) { scope = scope.substring(1); } String[] returnArray = new String[3]; returnArray[0] = policyName + "." + version + ".xml"; returnArray[2] = version; returnArray[1] = scope; return returnArray; } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); static PolicyDbDao getPolicyDbDaoInstance(); void setPapEngine(PAPPolicyEngine papEngine2); @SuppressWarnings("deprecation") void startTransactionSynced(Session session, int waitTime); PolicyDbDaoTransaction getNewTransaction(); PolicyDbDaoTransaction getNewAuditTransaction(); static boolean stringEquals(String one, String two); String[] getPapUrlUserPass(); String[] splitPapUrlUserPass(String url); StdPDPGroup synchronizeGroupPoliciesInFileSystem(StdPDPGroup pdpGroup, GroupEntity groupentity); String removeExtensionAndVersionFromPolicyName(String originalPolicyName); String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName); String getPdpPolicyName(String name, String scope); void auditLocalDatabase(PAPPolicyEngine papEngine2); StdPDPGroup auditLocalFileSystem(StdPDPGroup group); void synchronizeConfigDataInFileSystem(); void deleteAllGroupTables(); @SuppressWarnings("unchecked") void auditGroups(PAPPolicyEngine papEngine2); String getConfigFile(String filename, PolicyRestAdapter policy); String getConfigFile(String inputFilename, String configType); String[] getNameScopeAndVersionFromPdpPolicy(String fileName); static String createNewPdpGroupId(String name); static boolean isNullOrEmpty(String... strings); List<?> getOtherServers(); void setOtherServers(List<?> otherServers); PAPPolicyEngine getPapEngine(); static boolean isJunit(); static void setJunit(boolean isJunit); static PolicyDbDaoTestClass getPolicyDbDaoTestClass(); }
PolicyDbDao { public String[] getNameScopeAndVersionFromPdpPolicy(String fileName) { String[] splitByDots = fileName.split("\\."); if (splitByDots.length < 3) { return null; } String policyName = splitByDots[splitByDots.length - 3]; String version = splitByDots[splitByDots.length - 2]; String scope = ""; for (int i = 0; i < splitByDots.length - 3; i++) { scope += ".".concat(splitByDots[i]); } if (scope.length() > 0) { scope = scope.substring(1); } String[] returnArray = new String[3]; returnArray[0] = policyName + "." + version + ".xml"; returnArray[2] = version; returnArray[1] = scope; return returnArray; } @Autowired  PolicyDbDao(SessionFactory sessionFactory);  PolicyDbDao();  PolicyDbDao(String init); static PolicyDbDao getPolicyDbDaoInstance(); void setPapEngine(PAPPolicyEngine papEngine2); @SuppressWarnings("deprecation") void startTransactionSynced(Session session, int waitTime); PolicyDbDaoTransaction getNewTransaction(); PolicyDbDaoTransaction getNewAuditTransaction(); static boolean stringEquals(String one, String two); String[] getPapUrlUserPass(); String[] splitPapUrlUserPass(String url); StdPDPGroup synchronizeGroupPoliciesInFileSystem(StdPDPGroup pdpGroup, GroupEntity groupentity); String removeExtensionAndVersionFromPolicyName(String originalPolicyName); String[] getPolicyNameAndVersionFromPolicyFileName(String originalPolicyName); String getPdpPolicyName(String name, String scope); void auditLocalDatabase(PAPPolicyEngine papEngine2); StdPDPGroup auditLocalFileSystem(StdPDPGroup group); void synchronizeConfigDataInFileSystem(); void deleteAllGroupTables(); @SuppressWarnings("unchecked") void auditGroups(PAPPolicyEngine papEngine2); String getConfigFile(String filename, PolicyRestAdapter policy); String getConfigFile(String inputFilename, String configType); String[] getNameScopeAndVersionFromPdpPolicy(String fileName); static String createNewPdpGroupId(String name); static boolean isNullOrEmpty(String... strings); List<?> getOtherServers(); void setOtherServers(List<?> otherServers); PAPPolicyEngine getPapEngine(); static boolean isJunit(); static void setJunit(boolean isJunit); static PolicyDbDaoTestClass getPolicyDbDaoTestClass(); static final String JSON_CONFIG; static final String XML_CONFIG; static final String PROPERTIES_CONFIG; static final String OTHER_CONFIG; static final String AUDIT_USER; static final String CONFIG; static final String ACTION; static final String GROUP_ID; static final String DELETED; static final String GROUPENTITY_SELECT; static final String PDPENTITY_SELECT; static final String GROUP_NOT_FOUND; static final String FOUND_IN_DB_NOT_DEL; static final String MORE_THAN_ONE_PDP; static final String DELETED_STATUS_FOUND; static final String DUPLICATE_GROUPID; static final String PDP_ID; static final String QUERY_FAILED_FOR_GROUP; static final String QUERY_FAILED_GET_GROUP; static final String SCOPE; static final String POLICYDBDAO_VAR; static final String DUP_POLICYID; static final String FOUND_IN_DB; }