diff --git a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java index 675a979afb..acb7002ced 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java +++ b/src/test/java/neqsim/processSimulation/processSystem/MLA_bug_test.java @@ -363,22 +363,26 @@ public void runProcessTEG() throws InterruptedException { @Test void testRunNEQSIMAPI() { XStream xstream = new XStream(); - xstream.addPermission(AnyTypePermission.ANY); - // Specify the file path to read - Path filePath = Paths.get("/workspaces/neqsim/src/test/java/neqsim/processSimulation/processSystem/my_process_TEG.xml"); - String xmlContents = ""; - try { - xmlContents = Files.readString(filePath); - } catch (IOException e) { - e.printStackTrace(); - } - - // Deserialize from xml - neqsim.processSimulation.processSystem.ProcessSystem operationsCopy = - (neqsim.processSimulation.processSystem.ProcessSystem) xstream.fromXML(xmlContents); - operationsCopy.run(); - neqsim.processSimulation.processEquipment.stream.Stream makeUpTEG = (neqsim.processSimulation.processEquipment.stream.Stream) operationsCopy.getUnit("makeup TEG"); - Assertions.assertEquals(makeUpTEG.getFlowRate("kg/hr"), 0.22761215378293284); + xstream.addPermission(AnyTypePermission.ANY); + // Specify the file path to read + + Path filePath = Paths.get( + "/workspaces/neqsim/src/test/java/neqsim/processSimulation/processSystem/my_process_TEG.xml"); + String xmlContents = ""; + try { + xmlContents = new String(Files.readAllBytes(filePath)); + } catch (IOException e) { + e.printStackTrace(); + } + + // Deserialize from xml + neqsim.processSimulation.processSystem.ProcessSystem operationsCopy = + (neqsim.processSimulation.processSystem.ProcessSystem) xstream.fromXML(xmlContents); + operationsCopy.run(); + neqsim.processSimulation.processEquipment.stream.Stream makeUpTEG = + (neqsim.processSimulation.processEquipment.stream.Stream) operationsCopy + .getUnit("makeup TEG"); + Assertions.assertEquals(makeUpTEG.getFlowRate("kg/hr"), 0.22761215378293284); } diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java index db546bc725..8cff13acfa 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/Degasser.java @@ -192,27 +192,37 @@ private int findComponentIndex(String[] componentNames, String componentName) { @Test void testRun2() { XStream xstream = new XStream(); - xstream.addPermission(AnyTypePermission.ANY); - // Specify the file path to read - Path filePath = Paths.get("/workspaces/neqsim/src/test/java/neqsim/thermodynamicOperations/flashOps/my_process.xml"); - String xmlContents = ""; - try { - xmlContents = Files.readString(filePath); - } catch (IOException e) { - e.printStackTrace(); - } + xstream.addPermission(AnyTypePermission.ANY); + // Specify the file path to read + Path filePath = Paths.get( + "/workspaces/neqsim/src/test/java/neqsim/thermodynamicOperations/flashOps/my_process.xml"); + String xmlContents = ""; + try { + xmlContents = new String(Files.readAllBytes(filePath)); + } catch (IOException e) { + e.printStackTrace(); + } - // Deserialize from xml - neqsim.processSimulation.processSystem.ProcessSystem operationsCopy = - (neqsim.processSimulation.processSystem.ProcessSystem) xstream.fromXML(xmlContents); - operationsCopy.run(); - neqsim.processSimulation.processEquipment.separator.Separator VD02Separator = (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy.getUnit("Separator after CFU gas"); - neqsim.processSimulation.processEquipment.separator.Separator VD01Separator = (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy.getUnit("Separator after degasser gas"); - neqsim.processSimulation.processEquipment.separator.Separator Degasser = (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy.getUnit("Degasser"); - System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + Degasser.getGasOutStream().getFlowRate("kg/hr")); - System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + VD01Separator.getGasOutStream().getFlowRate("kg/hr")); - VD02Separator.getGasOutStream().run(); - System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + VD02Separator.getGasOutStream().getFlowRate("kg/hr")); + // Deserialize from xml + neqsim.processSimulation.processSystem.ProcessSystem operationsCopy = + (neqsim.processSimulation.processSystem.ProcessSystem) xstream.fromXML(xmlContents); + operationsCopy.run(); + neqsim.processSimulation.processEquipment.separator.Separator VD02Separator = + (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy + .getUnit("Separator after CFU gas"); + neqsim.processSimulation.processEquipment.separator.Separator VD01Separator = + (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy + .getUnit("Separator after degasser gas"); + neqsim.processSimulation.processEquipment.separator.Separator Degasser = + (neqsim.processSimulation.processEquipment.separator.Separator) operationsCopy + .getUnit("Degasser"); + System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + + Degasser.getGasOutStream().getFlowRate("kg/hr")); + System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + + VD01Separator.getGasOutStream().getFlowRate("kg/hr")); + VD02Separator.getGasOutStream().run(); + System.out.println("The gas flow rate should be < 200 kg/hr, the actual value is " + + VD02Separator.getGasOutStream().getFlowRate("kg/hr")); } }