private void assertGroupMetadata(String dir) throws Exception { String savedMetadata = IOHelper.loadFileContents(dir, ClassNameUtil.METADATA_FILE_NAME); assertEquals( "{\"type\":\"ACTION_GROUP\",\"name\":\"Test Group 001\",\"title\":\"Test Group 001\"}", savedMetadata); }
private void verifyActionCanBeSaved(String name, String title, String path) throws Exception { // Archives the existing action and saves it with another name File actionZipFile = new File(REPOSITORY_ROOT_DIR, "action/default_group/validAction.zip"); File newActionDir = new File(REPOSITORY_ROOT_DIR, "action/" + path); assertFalse(newActionDir.exists()); IOHelper.zipDirectory(VALID_ACTION_DIR, actionZipFile); try (InputStream is = new FileInputStream(actionZipFile)) { repository.save(name, is); } assertTrue(newActionDir.isDirectory()); IOHelper.assertEqualDirs(VALID_ACTION_DIR, newActionDir); File metaFile = new File(REPOSITORY_ROOT_DIR, "action/" + path + "/" + ClassNameUtil.METADATA_FILE_NAME); Map<String, String> metaData = IOHelper.toMap(metaFile); assertEquals(3, metaData.size()); assertEquals(Metadata.ACTION_TYPE, metaData.get(Metadata.TYPE)); assertEquals(name, metaData.get(Metadata.NAME)); assertEquals(title, metaData.get(Metadata.TITLE)); }