DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> updateObject(QueryContext qc) throws ValveException { boolean result = false; try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { this.DELEGATOR.updateObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); } result = true; } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve updateObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(result); } DotValve(Map<String, String> config);  DotValve(DotClient client, DotDelegator delegator); @Override String getName(); @Override String getDescription(); @Override String getObjectSelectionCapability(String WMLtypeIn); @Override @Async("asyncCustomTaskExecutor") CompletableFuture<String> getObject(QueryContext qc); static boolean trajHasSearchQueryArgs( QueryContext qc ); @Override @Async("asyncCustomTaskExecutor") CompletableFuture<String> createObject(QueryContext qc); @Override @Async("asyncCustomTaskExecutor") CompletableFuture<Boolean> deleteObject(QueryContext qc); @Override @Async("asyncCustomTaskExecutor") CompletableFuture<Boolean> updateObject(QueryContext qc); @Override void authenticate(String username, String password); Map<String, AbstractWitsmlObject[]> getCap();  }
@Test public void shouldUpdateObject() throws Exception { ArrayList<AbstractWitsmlObject> witsmlObjects; witsmlObjects = new ArrayList<>(); ObjWellbore wellboreA = new ObjWellbore(); wellboreA.setName("wellbore-A"); wellboreA.setUid("wellbore-A"); witsmlObjects.add(wellboreA); QueryContext qc = new QueryContext( "1.3.1.1", "wellbore", null, "", witsmlObjects, "goodUsername", "goodPassword", "shouldUpdateObject" ); this.valve.updateObject(qc); verify(this.mockDelegator).updateObject(wellboreA, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.mockClient); verifyNoMoreInteractions(this.mockDelegator); }
@Test public void shouldUpdateTrajectory() throws Exception { ArrayList<AbstractWitsmlObject> trajs1311 = new ArrayList<>(); ArrayList<AbstractWitsmlObject> trajs1411 = new ArrayList<>(); ObjTrajectory traj1311 = new ObjTrajectory(); traj1311.setName("traj-1311"); traj1311.setUid("traj-1311"); trajs1311.add(traj1311); com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory traj1411 = new com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory(); traj1411.setName("traj-1411"); traj1411.setUid("traj-1411"); trajs1411.add(traj1411); QueryContext qc1311 = new QueryContext( "1.3.1.1", "trajectory", null, "", trajs1311, "goodUsername", "goodPassword", "shouldUpdateTrajectory-1311" ); QueryContext qc1411 = new QueryContext( "1.4.1.1", "trajectory", null, "", trajs1411, "goodUsername", "goodPassword", "shouldUpdateTrajectory-1411" ); this.valve.updateObject(qc1311); this.valve.updateObject(qc1411); verify(this.mockDelegator).updateObject(traj1311, qc1311.USERNAME, qc1311.PASSWORD, qc1311.EXCHANGE_ID, this.mockClient); verify(this.mockDelegator).updateObject(traj1411, qc1411.USERNAME, qc1411.PASSWORD, qc1411.EXCHANGE_ID, this.mockClient); verifyNoMoreInteractions(this.mockDelegator); }