@Test public void consolidateObjectsToXMLTrajectoryTest() throws ValveException { ArrayList<AbstractWitsmlObject> witsmlObjects = new ArrayList<>(); ObjTrajectory trajectory = new ObjTrajectory(); trajectory.setName("trajectory-1"); trajectory.setUid("trajectory-1"); witsmlObjects.add(trajectory); String clientVersion = "1.3.1.1"; String objectType = "trajectory"; String expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><trajectorys version=\"1.3.1.1\" xmlns=\"http: String actual = DotTranslator.consolidateObjectsToXML(witsmlObjects, clientVersion, objectType); assertEquals(expected, actual); witsmlObjects = new ArrayList<>(); com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory traj1411 = new com.hashmapinc.tempus.WitsmlObjects.v1411.ObjTrajectory(); traj1411.setName("trajectory-1"); traj1411.setUid("trajectory-1"); witsmlObjects.add(traj1411); clientVersion = "1.4.1.1"; objectType = "trajectory"; expected = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><trajectorys version=\"1.4.1.1\" xmlns=\"http: actual = DotTranslator.consolidateObjectsToXML(witsmlObjects, clientVersion, objectType); System.out.println(actual); assertEquals(expected, actual); }
public static String consolidateObjectsToXML( ArrayList<AbstractWitsmlObject> witsmlObjects, String version, String objectType ) throws ValveException { if(!"1.3.1.1".equals(version) && !"1.4.1.1".equals(version)) { throw new ValveException("Unsupported client version <" + version + "> in DoT GET"); } String xmlString; switch (objectType.toLowerCase()) { case "well": xmlString = consolidateWellsToXML(witsmlObjects, version); break; case "wellbore": xmlString = consolidateWellboresToXML(witsmlObjects, version); break; case "trajectory": xmlString = consolidateTrajectoriesToXML(witsmlObjects, version); break; case "log": xmlString = consolidateLogsToXML(witsmlObjects, version); break; case "fluidsreport": xmlString = consolidateFluidsReportsToXML(witsmlObjects, version); break; default: throw new ValveException("Unsupported object type: " + witsmlObjects.get(0).getObjectType()); } return xmlString; }
DotTranslator { public static String consolidateObjectsToXML( ArrayList<AbstractWitsmlObject> witsmlObjects, String version, String objectType ) throws ValveException { if(!"1.3.1.1".equals(version) && !"1.4.1.1".equals(version)) { throw new ValveException("Unsupported client version <" + version + "> in DoT GET"); } String xmlString; switch (objectType.toLowerCase()) { case "well": xmlString = consolidateWellsToXML(witsmlObjects, version); break; case "wellbore": xmlString = consolidateWellboresToXML(witsmlObjects, version); break; case "trajectory": xmlString = consolidateTrajectoriesToXML(witsmlObjects, version); break; case "log": xmlString = consolidateLogsToXML(witsmlObjects, version); break; case "fluidsreport": xmlString = consolidateFluidsReportsToXML(witsmlObjects, version); break; default: throw new ValveException("Unsupported object type: " + witsmlObjects.get(0).getObjectType()); } return xmlString; } }
DotTranslator { public static String consolidateObjectsToXML( ArrayList<AbstractWitsmlObject> witsmlObjects, String version, String objectType ) throws ValveException { if(!"1.3.1.1".equals(version) && !"1.4.1.1".equals(version)) { throw new ValveException("Unsupported client version <" + version + "> in DoT GET"); } String xmlString; switch (objectType.toLowerCase()) { case "well": xmlString = consolidateWellsToXML(witsmlObjects, version); break; case "wellbore": xmlString = consolidateWellboresToXML(witsmlObjects, version); break; case "trajectory": xmlString = consolidateTrajectoriesToXML(witsmlObjects, version); break; case "log": xmlString = consolidateLogsToXML(witsmlObjects, version); break; case "fluidsreport": xmlString = consolidateFluidsReportsToXML(witsmlObjects, version); break; default: throw new ValveException("Unsupported object type: " + witsmlObjects.get(0).getObjectType()); } return xmlString; }  }
DotTranslator { public static String consolidateObjectsToXML( ArrayList<AbstractWitsmlObject> witsmlObjects, String version, String objectType ) throws ValveException { if(!"1.3.1.1".equals(version) && !"1.4.1.1".equals(version)) { throw new ValveException("Unsupported client version <" + version + "> in DoT GET"); } String xmlString; switch (objectType.toLowerCase()) { case "well": xmlString = consolidateWellsToXML(witsmlObjects, version); break; case "wellbore": xmlString = consolidateWellboresToXML(witsmlObjects, version); break; case "trajectory": xmlString = consolidateTrajectoriesToXML(witsmlObjects, version); break; case "log": xmlString = consolidateLogsToXML(witsmlObjects, version); break; case "fluidsreport": xmlString = consolidateFluidsReportsToXML(witsmlObjects, version); break; default: throw new ValveException("Unsupported object type: " + witsmlObjects.get(0).getObjectType()); } return xmlString; }  static AbstractWitsmlObject get1311WitsmlObject(AbstractWitsmlObject wmlObj); static AbstractWitsmlObject translateQueryResponse( AbstractWitsmlObject wmlObject,
                                                               String jsonResponseString,
                                                               Map<String, String> optionsIn ); static AbstractWitsmlObject createFsRQueryResponse( String jsonResponseString,
                                                               AbstractWitsmlObject witsmlObject ); static String consolidateObjectsToXML(
            ArrayList<AbstractWitsmlObject> witsmlObjects,
            String version,
            String objectType
    ); }
DotTranslator { public static String consolidateObjectsToXML( ArrayList<AbstractWitsmlObject> witsmlObjects, String version, String objectType ) throws ValveException { if(!"1.3.1.1".equals(version) && !"1.4.1.1".equals(version)) { throw new ValveException("Unsupported client version <" + version + "> in DoT GET"); } String xmlString; switch (objectType.toLowerCase()) { case "well": xmlString = consolidateWellsToXML(witsmlObjects, version); break; case "wellbore": xmlString = consolidateWellboresToXML(witsmlObjects, version); break; case "trajectory": xmlString = consolidateTrajectoriesToXML(witsmlObjects, version); break; case "log": xmlString = consolidateLogsToXML(witsmlObjects, version); break; case "fluidsreport": xmlString = consolidateFluidsReportsToXML(witsmlObjects, version); break; default: throw new ValveException("Unsupported object type: " + witsmlObjects.get(0).getObjectType()); } return xmlString; }  static AbstractWitsmlObject get1311WitsmlObject(AbstractWitsmlObject wmlObj); static AbstractWitsmlObject translateQueryResponse( AbstractWitsmlObject wmlObject,
                                                               String jsonResponseString,
                                                               Map<String, String> optionsIn ); static AbstractWitsmlObject createFsRQueryResponse( String jsonResponseString,
                                                               AbstractWitsmlObject witsmlObject ); static String consolidateObjectsToXML(
            ArrayList<AbstractWitsmlObject> witsmlObjects,
            String version,
            String objectType
    );  }