@Test public void acceptResultTest() throws Exception { List<Result> results = new ArrayList<>(); results.add(new Result("test", "test value")); TrainingSet trainingSet = new TrainingSet(0, 1); ResultSet resultSet = new ResultSet(); resultSet.setResults(results); resultSet.setTrainingSet(trainingSet); assertThat(manager.acceptResult(resultSet)).isTrue(); assertThat(manager.acceptResult(resultSet)).isFalse(); assertThat(Files.exists(Paths.get("data/test"))).isTrue(); Files.delete(Paths.get("data/test")); }
public synchronized boolean acceptResult(ResultSet resultSet) { if (allResults.containsKey(resultSet.getTrainingSet().getTrainingSetID())) { return false; } allResults.put(resultSet.getTrainingSet().getTrainingSetID(), resultSet); ManagerRegistry.getTrainingSetManager().releaseTrainingSet(resultSet.getClientID(), true); saveResultSet(resultSet); return true; }
ResultManager { public synchronized boolean acceptResult(ResultSet resultSet) { if (allResults.containsKey(resultSet.getTrainingSet().getTrainingSetID())) { return false; } allResults.put(resultSet.getTrainingSet().getTrainingSetID(), resultSet); ManagerRegistry.getTrainingSetManager().releaseTrainingSet(resultSet.getClientID(), true); saveResultSet(resultSet); return true; } }
ResultManager { public synchronized boolean acceptResult(ResultSet resultSet) { if (allResults.containsKey(resultSet.getTrainingSet().getTrainingSetID())) { return false; } allResults.put(resultSet.getTrainingSet().getTrainingSetID(), resultSet); ManagerRegistry.getTrainingSetManager().releaseTrainingSet(resultSet.getClientID(), true); saveResultSet(resultSet); return true; } ResultManager(); }
ResultManager { public synchronized boolean acceptResult(ResultSet resultSet) { if (allResults.containsKey(resultSet.getTrainingSet().getTrainingSetID())) { return false; } allResults.put(resultSet.getTrainingSet().getTrainingSetID(), resultSet); ManagerRegistry.getTrainingSetManager().releaseTrainingSet(resultSet.getClientID(), true); saveResultSet(resultSet); return true; } ResultManager(); synchronized boolean acceptResult(ResultSet resultSet); }
ResultManager { public synchronized boolean acceptResult(ResultSet resultSet) { if (allResults.containsKey(resultSet.getTrainingSet().getTrainingSetID())) { return false; } allResults.put(resultSet.getTrainingSet().getTrainingSetID(), resultSet); ManagerRegistry.getTrainingSetManager().releaseTrainingSet(resultSet.getClientID(), true); saveResultSet(resultSet); return true; } ResultManager(); synchronized boolean acceptResult(ResultSet resultSet);  }