@Test @ExtendWith(TemporaryFolderExtension.class) void testLoadPolicyFolderIsFile(TemporaryFolder temporaryFolder) throws IOException { PolicyAndFolderLoader policyAndFolderLoader = new PolicyAndFolderLoader(policyConverterRegistry, FileUtils.INSTANCE, new IdGenerator(), JsonFileUtils.INSTANCE); temporaryFolder.createFile("policy"); Bundle bundle = new Bundle(); assertThrows(ConfigLoadException.class, () -> policyAndFolderLoader.load(bundle, temporaryFolder.getRoot())); }
@Override public void load(final Bundle bundle, final File rootDir) { final File policyRootDir = FolderLoaderUtils.getPolicyRootDir(rootDir); if (policyRootDir == null) return; final Map<String, Policy> policies = new HashMap<>(); loadPolicies(policyRootDir, policyRootDir, null, policies, bundle); loadPoliciesMetadata(rootDir, policies, bundle); bundle.putAllPolicies(policies); }
PolicyAndFolderLoader implements EntityLoader { @Override public void load(final Bundle bundle, final File rootDir) { final File policyRootDir = FolderLoaderUtils.getPolicyRootDir(rootDir); if (policyRootDir == null) return; final Map<String, Policy> policies = new HashMap<>(); loadPolicies(policyRootDir, policyRootDir, null, policies, bundle); loadPoliciesMetadata(rootDir, policies, bundle); bundle.putAllPolicies(policies); } }
PolicyAndFolderLoader implements EntityLoader { @Override public void load(final Bundle bundle, final File rootDir) { final File policyRootDir = FolderLoaderUtils.getPolicyRootDir(rootDir); if (policyRootDir == null) return; final Map<String, Policy> policies = new HashMap<>(); loadPolicies(policyRootDir, policyRootDir, null, policies, bundle); loadPoliciesMetadata(rootDir, policies, bundle); bundle.putAllPolicies(policies); } @Inject  PolicyAndFolderLoader(PolicyConverterRegistry policyConverterRegistry, FileUtils fileUtils,
                          IdGenerator idGenerator, JsonFileUtils jsonFileUtils); }
PolicyAndFolderLoader implements EntityLoader { @Override public void load(final Bundle bundle, final File rootDir) { final File policyRootDir = FolderLoaderUtils.getPolicyRootDir(rootDir); if (policyRootDir == null) return; final Map<String, Policy> policies = new HashMap<>(); loadPolicies(policyRootDir, policyRootDir, null, policies, bundle); loadPoliciesMetadata(rootDir, policies, bundle); bundle.putAllPolicies(policies); } @Inject  PolicyAndFolderLoader(PolicyConverterRegistry policyConverterRegistry, FileUtils fileUtils,
                          IdGenerator idGenerator, JsonFileUtils jsonFileUtils); @Override void load(final Bundle bundle, final File rootDir); @Override void load(Bundle bundle, String name, String value); @Override Object loadSingle(String name, File entitiesFile); @Override Map<String, Object> load(File entitiesFile); @Override String getEntityType(); }
PolicyAndFolderLoader implements EntityLoader { @Override public void load(final Bundle bundle, final File rootDir) { final File policyRootDir = FolderLoaderUtils.getPolicyRootDir(rootDir); if (policyRootDir == null) return; final Map<String, Policy> policies = new HashMap<>(); loadPolicies(policyRootDir, policyRootDir, null, policies, bundle); loadPoliciesMetadata(rootDir, policies, bundle); bundle.putAllPolicies(policies); } @Inject  PolicyAndFolderLoader(PolicyConverterRegistry policyConverterRegistry, FileUtils fileUtils,
                          IdGenerator idGenerator, JsonFileUtils jsonFileUtils); @Override void load(final Bundle bundle, final File rootDir); @Override void load(Bundle bundle, String name, String value); @Override Object loadSingle(String name, File entitiesFile); @Override Map<String, Object> load(File entitiesFile); @Override String getEntityType();  }