@Test void loadSingleInvalidExtension() throws IOException { CertificatesLoader loader = new CertificatesLoader(FileUtils.INSTANCE); createCertificates("cert1.cerT"); assertThrows(ConfigLoadException.class, () -> loader.loadSingle("cert1", new File(certsDir, "cert1.cerT"))); }
@Override public Object loadSingle(String name, File entitiesFile) { if (!checkCertFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must have a valid certificate extension."); } return fileUtils.getFileAsString(entitiesFile); }
CertificatesLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkCertFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must have a valid certificate extension."); } return fileUtils.getFileAsString(entitiesFile); } }
CertificatesLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkCertFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must have a valid certificate extension."); } return fileUtils.getFileAsString(entitiesFile); } @Inject  CertificatesLoader(FileUtils fileUtils); }
CertificatesLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkCertFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must have a valid certificate extension."); } return fileUtils.getFileAsString(entitiesFile); } @Inject  CertificatesLoader(FileUtils fileUtils); @Override void load(Bundle bundle, 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(); }
CertificatesLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkCertFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must have a valid certificate extension."); } return fileUtils.getFileAsString(entitiesFile); } @Inject  CertificatesLoader(FileUtils fileUtils); @Override void load(Bundle bundle, 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();  }