@Test public void shouldGetSingleObject() throws Exception { ArrayList<AbstractWitsmlObject> witsmlObjects; witsmlObjects = new ArrayList<>(); ObjWell well = new ObjWell(); well.setName("well-1"); well.setUid("well-1"); witsmlObjects.add(well); QueryContext qc = new QueryContext( "1.3.1.1", "well", new HashMap<>(), "", witsmlObjects, "goodUsername", "goodPassword", "shouldGetSingleObject" ); when( this.mockDelegator.getObject(well, qc.USERNAME, qc.PASSWORD,qc.EXCHANGE_ID, this.mockClient, qc.OPTIONS_IN) ).thenReturn(well); String expected = well.getXMLString("1.3.1.1"); String actual = this.valve.getObject(qc).get(); assertEquals(expected, actual); }
@Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> getObject(QueryContext qc) throws ValveException { ArrayList<AbstractWitsmlObject> queryResponses; if (qc.WITSML_OBJECTS.size() == 1 && (qc.WITSML_OBJECTS.get(0).getUid() == null || "".equals(qc.WITSML_OBJECTS.get(0).getUid()))) { queryResponses = doSearch(qc); } else { if ( "trajectory".equals(qc.OBJECT_TYPE) && trajHasSearchQueryArgs(qc) ) { queryResponses = doSearch(qc); } else { queryResponses = getSingularObject(qc); } } String xmlResponse = DotTranslator.consolidateObjectsToXML(queryResponses, qc.CLIENT_VERSION, qc.OBJECT_TYPE); return CompletableFuture.completedFuture(xmlResponse); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> getObject(QueryContext qc) throws ValveException { ArrayList<AbstractWitsmlObject> queryResponses; if (qc.WITSML_OBJECTS.size() == 1 && (qc.WITSML_OBJECTS.get(0).getUid() == null || "".equals(qc.WITSML_OBJECTS.get(0).getUid()))) { queryResponses = doSearch(qc); } else { if ( "trajectory".equals(qc.OBJECT_TYPE) && trajHasSearchQueryArgs(qc) ) { queryResponses = doSearch(qc); } else { queryResponses = getSingularObject(qc); } } String xmlResponse = DotTranslator.consolidateObjectsToXML(queryResponses, qc.CLIENT_VERSION, qc.OBJECT_TYPE); return CompletableFuture.completedFuture(xmlResponse); } }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> getObject(QueryContext qc) throws ValveException { ArrayList<AbstractWitsmlObject> queryResponses; if (qc.WITSML_OBJECTS.size() == 1 && (qc.WITSML_OBJECTS.get(0).getUid() == null || "".equals(qc.WITSML_OBJECTS.get(0).getUid()))) { queryResponses = doSearch(qc); } else { if ( "trajectory".equals(qc.OBJECT_TYPE) && trajHasSearchQueryArgs(qc) ) { queryResponses = doSearch(qc); } else { queryResponses = getSingularObject(qc); } } String xmlResponse = DotTranslator.consolidateObjectsToXML(queryResponses, qc.CLIENT_VERSION, qc.OBJECT_TYPE); return CompletableFuture.completedFuture(xmlResponse); } DotValve(Map<String, String> config);  DotValve(DotClient client, DotDelegator delegator); }
DotValve implements IValve { @Override @Async("asyncCustomTaskExecutor") public CompletableFuture<String> getObject(QueryContext qc) throws ValveException { ArrayList<AbstractWitsmlObject> queryResponses; if (qc.WITSML_OBJECTS.size() == 1 && (qc.WITSML_OBJECTS.get(0).getUid() == null || "".equals(qc.WITSML_OBJECTS.get(0).getUid()))) { queryResponses = doSearch(qc); } else { if ( "trajectory".equals(qc.OBJECT_TYPE) && trajHasSearchQueryArgs(qc) ) { queryResponses = doSearch(qc); } else { queryResponses = getSingularObject(qc); } } String xmlResponse = DotTranslator.consolidateObjectsToXML(queryResponses, qc.CLIENT_VERSION, qc.OBJECT_TYPE); return CompletableFuture.completedFuture(xmlResponse); } 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> getObject(QueryContext qc) throws ValveException { ArrayList<AbstractWitsmlObject> queryResponses; if (qc.WITSML_OBJECTS.size() == 1 && (qc.WITSML_OBJECTS.get(0).getUid() == null || "".equals(qc.WITSML_OBJECTS.get(0).getUid()))) { queryResponses = doSearch(qc); } else { if ( "trajectory".equals(qc.OBJECT_TYPE) && trajHasSearchQueryArgs(qc) ) { queryResponses = doSearch(qc); } else { queryResponses = getSingularObject(qc); } } String xmlResponse = DotTranslator.consolidateObjectsToXML(queryResponses, qc.CLIENT_VERSION, qc.OBJECT_TYPE); return CompletableFuture.completedFuture(xmlResponse); } 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();  }