JdbcProjectImpl implements ProjectLoader { @Override public Map<String, Props> fetchProjectProperties(final int projectId, final int version) throws ProjectManagerException { try { final List<Pair<String, Props>> properties = this.dbOperator .query(ProjectPropertiesResultsHandler.SELECT_PROJECT_PROPERTIES, new ProjectPropertiesResultsHandler(), projectId, version); if (properties == null || properties.isEmpty()) { return null; } final HashMap<String, Props> props = new HashMap<>(); for (final Pair<String, Props> pair : properties) { props.put(pair.getFirst(), pair.getSecond()); } return props; } catch (final SQLException e) { logger.error("Error fetching properties, project id" + projectId + " version " + version, e); throw new ProjectManagerException("Error fetching properties", e); } } @Inject  JdbcProjectImpl(final Props props, final DatabaseOperator databaseOperator); @Override List<Project> fetchAllActiveProjects(); @Override Project fetchProjectById(final int id); @Override Project fetchProjectByName(final String name); @Override synchronized Project createNewProject(final String name, final String description,
      final User creator); @Override void uploadProjectFile(final int projectId, final int version, final File localFile,
      final String uploader, final String uploaderIPAddr); @Override void addProjectVersion(final int projectId, final int version, final File localFile,
      final File startupDependencies, final String uploader, final byte[] md5,
      final String resourceId, final String uploaderIPAddr); @Override ProjectFileHandler fetchProjectMetaData(final int projectId, final int version); @Override ProjectFileHandler getUploadedFile(final int projectId, final int version); @Override void changeProjectVersion(final Project project, final int version, final String user); @Override void updatePermission(final Project project, final String name, final Permission perm,
      final boolean isGroup); @Override void updateProjectSettings(final Project project); @Override void removePermission(final Project project, final String name, final boolean isGroup); @Override void removeProject(final Project project, final String user); @Override boolean postEvent(final Project project, final EventType type, final String user,
      final String message); @Override List<ProjectLogEvent> getProjectEvents(final Project project, final int num,
      final int skip); @Override void updateDescription(final Project project, final String description, final String user); @Override int getLatestProjectVersion(final Project project); @Override void uploadFlows(final Project project, final int version, final Collection<Flow> flows); @Override void uploadFlow(final Project project, final int version, final Flow flow); @Override void updateFlow(final Project project, final int version, final Flow flow); @Override Flow fetchFlow(final Project project, final String flowId); @Override List<Flow> fetchAllProjectFlows(final Project project); @Override Map<Project, List<Flow>> fetchAllFlowsForProjects(final List<Project> projects); @Override void uploadProjectProperties(final Project project, final List<Props> properties); @Override void uploadProjectProperty(final Project project, final Props props); @Override void updateProjectProperty(final Project project, final Props props); @Override Props fetchProjectProperty(final int projectId, final int projectVer,
      final String propsName); @Override Props fetchProjectProperty(final Project project, final String propsName); @Override Map<String, Props> fetchProjectProperties(final int projectId, final int version); @Override void cleanOlderProjectVersion(final int projectId, final int version,
      final List<Integer> excludedVersions); @Override void uploadFlowFile(final int projectId, final int projectVersion, final File flowFile,
      final int flowVersion); @Override File getUploadedFlowFile(final int projectId, final int projectVersion,
      final String flowFileName, final int flowVersion, final File tempDir); @Override int getLatestFlowVersion(final int projectId, final int projectVersion,
      final String flowName); @Override boolean isFlowFileUploaded(final int projectId, final int projectVersion); @Override List<Project> fetchProjectById(final List<Integer> ids);  }
@Test public void testFetchProjectProperties() throws Exception { final Props props1 = new Props(); props1.setSource("source1"); props1.put("key1", "value1"); props1.put("key2", "value2"); final Props props2 = new Props(); props2.setSource("source2"); props2.put("keykey", "valuevalue1"); props2.put("keyaaa", "valueaaa"); final List<Props> list = Arrays.asList(props1, props2); createThreeProjects(); final Project project = this.loader.fetchProjectByName("mytestProject"); this.loader.uploadProjectProperties(project, list); final Map<String, Props> propsMap = this.loader .fetchProjectProperties(project.getId(), project.getVersion()); Assert.assertEquals(propsMap.get("source1").get("key2"), "value2"); Assert.assertEquals(propsMap.get("source2").get("keyaaa"), "valueaaa"); }