@Test public void shouldGetPluralObject() throws Exception { ArrayList<AbstractWitsmlObject> witsmlObjects; witsmlObjects = new ArrayList<>(); com.hashmapinc.tempus.WitsmlObjects.v1311.ObjWellbore wellboreA = new com.hashmapinc.tempus.WitsmlObjects.v1311.ObjWellbore(); wellboreA.setName("wellbore-A"); wellboreA.setUid("wellbore-A"); witsmlObjects.add(wellboreA); com.hashmapinc.tempus.WitsmlObjects.v1311.ObjWellbore wellboreB = new com.hashmapinc.tempus.WitsmlObjects.v1311.ObjWellbore(); wellboreB.setName("wellbore-B"); wellboreB.setUid("wellbore-B"); witsmlObjects.add(wellboreB); QueryContext qc = new QueryContext( "1.3.1.1", "wellbore", new HashMap<>(), "", witsmlObjects, "goodUsername", "goodPassword", "shouldGetPluralObject" ); doReturn(wellboreA).when(this.mockDelegator).getObject(wellboreA, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.mockClient, new HashMap<>()); doReturn(wellboreB).when(this.mockDelegator).getObject(wellboreB, qc.USERNAME, qc.PASSWORD, qc.EXCHANGE_ID, this.mockClient, new HashMap<>()); String expected = wellboreA.getXMLString("1.3.1.1").replace("</wellbores>", "") + wellboreB.getXMLString("1.3.1.1").replace( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<wellbores version=\"1.3.1.1\" xmlns=\"http: "" ); 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();  }