@Test public void shouldDeleteLogSubNode() throws Exception { ArrayList<AbstractWitsmlObject> logs1311 = new ArrayList<>(); ArrayList<AbstractWitsmlObject> logs1411 = new ArrayList<>(); ObjLogs logsObj1311 = new ObjLogs(); com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLogs logsObj1411 = new com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLogs(); ObjLog log1311 = new ObjLog(); log1311.setUid("HM_800023"); log1311.setUidWell("U2"); log1311.setUidWellbore("WBDD600"); log1311.setServiceCompany(null); log1311.setRunNumber(null); logs1311.add(log1311); logsObj1311.addLog(log1311); com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog log1411 = new com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog(); log1411.setUid("HM_800023"); log1411.setUidWell("U2"); log1411.setUidWellbore("WBDD600"); log1411.setServiceCompany(null); log1411.setRunNumber(null); logs1411.add(log1411); logsObj1411.addLog(log1411); QueryContext qc1311 = new QueryContext( "1.3.1.1", "log", null, WitsmlMarshal.serialize(logsObj1311), logs1311, "goodUsername", "goodPassword", "shouldDeleteLogSubNode-1311" ); QueryContext qc1411 = new QueryContext( "1.4.1.1", "log", null, WitsmlMarshal.serialize(logsObj1411), logs1411, "goodUsername", "goodPassword", "shouldDeleteLogSubNode-1411" ); this.valve.deleteObject(qc1311); this.valve.deleteObject(qc1411); verify(this.mockDelegator).deleteObject(log1311, qc1311.USERNAME, qc1311.PASSWORD, qc1311.EXCHANGE_ID, this.mockClient); verify(this.mockDelegator).deleteObject(log1411, qc1411.USERNAME, qc1411.PASSWORD, qc1411.EXCHANGE_ID, this.mockClient); verifyNoMoreInteractions(this.mockDelegator); }
@Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> deleteObject(QueryContext qc) throws ValveException { boolean result = false; if (qc.WITSML_OBJECTS.size() > 1) throw new ValveException("Delete cannot have more than one singular object per query", (short)-444); if (qc.WITSML_OBJECTS.size() == 0) throw new ValveException("Delete must have exactly one singluar object, but found 0 in the query"); try { AbstractWitsmlObject wmlObject = qc.WITSML_OBJECTS.get(0); if (wmlObject.getUid() == null || "".equals(wmlObject.getUid())){ throw new ValveException("Delete cannot have more than one singular object per query", (short)-415); } if (!isObjectDelete(wmlObject.getObjectType().toLowerCase(), qc.QUERY_XML.toLowerCase())){ this.DELEGATOR.performElementDelete(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } else { this.DELEGATOR.deleteObject(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve deleteObject: " + e.getMessage())); if (e.getClass() == ValveException.class) throw ((ValveException)e); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(result); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> deleteObject(QueryContext qc) throws ValveException { boolean result = false; if (qc.WITSML_OBJECTS.size() > 1) throw new ValveException("Delete cannot have more than one singular object per query", (short)-444); if (qc.WITSML_OBJECTS.size() == 0) throw new ValveException("Delete must have exactly one singluar object, but found 0 in the query"); try { AbstractWitsmlObject wmlObject = qc.WITSML_OBJECTS.get(0); if (wmlObject.getUid() == null || "".equals(wmlObject.getUid())){ throw new ValveException("Delete cannot have more than one singular object per query", (short)-415); } if (!isObjectDelete(wmlObject.getObjectType().toLowerCase(), qc.QUERY_XML.toLowerCase())){ this.DELEGATOR.performElementDelete(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } else { this.DELEGATOR.deleteObject(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve deleteObject: " + e.getMessage())); if (e.getClass() == ValveException.class) throw ((ValveException)e); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(result); } }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> deleteObject(QueryContext qc) throws ValveException { boolean result = false; if (qc.WITSML_OBJECTS.size() > 1) throw new ValveException("Delete cannot have more than one singular object per query", (short)-444); if (qc.WITSML_OBJECTS.size() == 0) throw new ValveException("Delete must have exactly one singluar object, but found 0 in the query"); try { AbstractWitsmlObject wmlObject = qc.WITSML_OBJECTS.get(0); if (wmlObject.getUid() == null || "".equals(wmlObject.getUid())){ throw new ValveException("Delete cannot have more than one singular object per query", (short)-415); } if (!isObjectDelete(wmlObject.getObjectType().toLowerCase(), qc.QUERY_XML.toLowerCase())){ this.DELEGATOR.performElementDelete(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } else { this.DELEGATOR.deleteObject(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve deleteObject: " + e.getMessage())); if (e.getClass() == ValveException.class) throw ((ValveException)e); throw new ValveException(e.getMessage()); } return CompletableFuture.completedFuture(result); } DotValve(Map<String, String> config);  DotValve(DotClient client, DotDelegator delegator); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> deleteObject(QueryContext qc) throws ValveException { boolean result = false; if (qc.WITSML_OBJECTS.size() > 1) throw new ValveException("Delete cannot have more than one singular object per query", (short)-444); if (qc.WITSML_OBJECTS.size() == 0) throw new ValveException("Delete must have exactly one singluar object, but found 0 in the query"); try { AbstractWitsmlObject wmlObject = qc.WITSML_OBJECTS.get(0); if (wmlObject.getUid() == null || "".equals(wmlObject.getUid())){ throw new ValveException("Delete cannot have more than one singular object per query", (short)-415); } if (!isObjectDelete(wmlObject.getObjectType().toLowerCase(), qc.QUERY_XML.toLowerCase())){ this.DELEGATOR.performElementDelete(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } else { this.DELEGATOR.deleteObject(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve deleteObject: " + e.getMessage())); if (e.getClass() == ValveException.class) throw ((ValveException)e); 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(); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<Boolean> deleteObject(QueryContext qc) throws ValveException { boolean result = false; if (qc.WITSML_OBJECTS.size() > 1) throw new ValveException("Delete cannot have more than one singular object per query", (short)-444); if (qc.WITSML_OBJECTS.size() == 0) throw new ValveException("Delete must have exactly one singluar object, but found 0 in the query"); try { AbstractWitsmlObject wmlObject = qc.WITSML_OBJECTS.get(0); if (wmlObject.getUid() == null || "".equals(wmlObject.getUid())){ throw new ValveException("Delete cannot have more than one singular object per query", (short)-415); } if (!isObjectDelete(wmlObject.getObjectType().toLowerCase(), qc.QUERY_XML.toLowerCase())){ this.DELEGATOR.performElementDelete(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } else { this.DELEGATOR.deleteObject(wmlObject, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.CLIENT); result = true; } } catch (Exception e) { LOG.warning(ValveLogging.getLogMsg(qc.EXCHANGE_ID,"Exception in DotValve deleteObject: " + e.getMessage())); if (e.getClass() == ValveException.class) throw ((ValveException)e); 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();  }