@Test public void shouldSearchWellsWithEmptyUID() throws Exception { String query = TestUtilities.getResourceAsString("well1311FullEmptyQueryNoUid.xml"); String response = TestUtilities.getResourceAsString("well1311FullEmptyQueryNoUidResponse.xml"); String completeResponse = TestUtilities.getResourceAsString("well1311NoUidSearchFullValveResponse.xml"); ObjWells wellsResponse= WitsmlMarshal.deserialize(response, ObjWells.class); ObjWells wellsQuery = WitsmlMarshal.deserialize(query, ObjWells.class); ObjWell singularWellQuery = wellsQuery.getWell().get(0); ObjWell singularWellResponse = wellsResponse.getWell().get(0); List<AbstractWitsmlObject> wmlObjectsQuery = new ArrayList<>(); wmlObjectsQuery.add(singularWellQuery); List<AbstractWitsmlObject> wmlObjectsResp = new ArrayList<>(); wmlObjectsResp.add(singularWellResponse); QueryContext qc = new QueryContext( "1.3.1.1", "well", new HashMap<>(), query, wmlObjectsQuery, "goodUsername", "goodPassword", "shouldGetPluralObject" ); doReturn(wmlObjectsResp).when(this.mockDelegator).search(singularWellQuery, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.mockClient, new HashMap<>()); String actual = this.valve.getObject(qc).get(); assertEquals(completeResponse, 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();  }