@Test public void shouldCreateSingleObject() 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", "shouldCreateSingleObject" ); when( this.mockDelegator.createObject(wellboreA, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.mockClient) ).thenReturn(wellboreA.getUid()); String expected = wellboreA.getUid(); String actual = this.valve.createObject(qc).get(); assertEquals(expected, actual); }
@Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> createObject(QueryContext qc) throws ValveException { ArrayList<String> uids = new ArrayList<>(); LOG.fine(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Async create object")); try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { uids.add(this.DELEGATOR.createObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT)); } } catch (ValveException e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage(), e.getErrorCode()); } catch (Exception e){ LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(StringUtils.join(uids, ',')); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> createObject(QueryContext qc) throws ValveException { ArrayList<String> uids = new ArrayList<>(); LOG.fine(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Async create object")); try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { uids.add(this.DELEGATOR.createObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT)); } } catch (ValveException e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage(), e.getErrorCode()); } catch (Exception e){ LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(StringUtils.join(uids, ',')); } }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> createObject(QueryContext qc) throws ValveException { ArrayList<String> uids = new ArrayList<>(); LOG.fine(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Async create object")); try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { uids.add(this.DELEGATOR.createObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT)); } } catch (ValveException e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage(), e.getErrorCode()); } catch (Exception e){ LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(StringUtils.join(uids, ',')); } DotValve(Map<String, String> config);  DotValve(DotClient client, DotDelegator delegator); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> createObject(QueryContext qc) throws ValveException { ArrayList<String> uids = new ArrayList<>(); LOG.fine(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Async create object")); try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { uids.add(this.DELEGATOR.createObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT)); } } catch (ValveException e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage(), e.getErrorCode()); } catch (Exception e){ LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(StringUtils.join(uids, ',')); } 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(); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> createObject(QueryContext qc) throws ValveException { ArrayList<String> uids = new ArrayList<>(); LOG.fine(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Async create object")); try { for (AbstractWitsmlObject witsmlObject : qc.WITSML_OBJECTS) { uids.add(this.DELEGATOR.createObject(witsmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT)); } } catch (ValveException e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage(), e.getErrorCode()); } catch (Exception e){ LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve createObject: " + e.getMessage())); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(StringUtils.join(uids, ',')); } 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();  }