Skip to content

Commit

Permalink
added test database (#378)
Browse files Browse the repository at this point in the history
* added test database

* implemente NeqSimTest base class

NeqSimTest base class used to set all tests to use test database. All tests set to extend NeqSimTest class.
  • Loading branch information
EvenSol authored Apr 4, 2022
1 parent a4b8c5d commit 022bc2c
Show file tree
Hide file tree
Showing 144 changed files with 153 additions and 81 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY AND SUBDIRECTORIES CONSTITUTE A DERBY ***
# *** DATABASE, WHICH INCLUDES THE DATA (USER AND SYSTEM) AND THE ***
# *** FILES NECESSARY FOR DATABASE RECOVERY. ***
# *** EDITING, ADDING, OR DELETING ANY OF THESE FILES MAY CAUSE DATA ***
# *** CORRUPTION AND LEAVE THE DATABASE IN A NON-RECOVERABLE STATE. ***
# *************************************************************************
2 changes: 2 additions & 0 deletions src/main/resources/data/neqsimtestdatabase/derby.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#Java DB Properties File
#Mon Mar 04 13:30:15 CET 2019
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE RECOVERY ***
# *** SYSTEM. EDITING, ADDING, OR DELETING FILES IN THIS DIRECTORY ***
# *** WILL CAUSE THE DERBY RECOVERY SYSTEM TO FAIL, LEADING TO ***
# *** NON-RECOVERABLE CORRUPT DATABASES. ***
# *************************************************************************
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

# *************************************************************************
# *** DO NOT TOUCH FILES IN THIS DIRECTORY! ***
# *** FILES IN THIS DIRECTORY ARE USED BY THE DERBY DATABASE TO STORE ***
# *** USER AND SYSTEM DATA. EDITING, ADDING, OR DELETING FILES IN THIS ***
# *** DIRECTORY WILL CORRUPT THE ASSOCIATED DERBY DATABASE AND MAKE ***
# *** IT NON-RECOVERABLE. ***
# *************************************************************************
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
23 changes: 23 additions & 0 deletions src/main/resources/data/neqsimtestdatabase/service.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#C:\programming\NeqSimSourceCode\java\neqsim\data\webdb\neqsimthermodatabase
# ********************************************************************
# *** Please do NOT edit this file. ***
# *** CHANGING THE CONTENT OF THIS FILE MAY CAUSE DATA CORRUPTION. ***
# ********************************************************************
#Tue Jan 31 10:41:02 CET 2017
SysschemasIndex2Identifier=225
SyscolumnsIdentifier=144
SysconglomeratesIndex1Identifier=49
SysconglomeratesIdentifier=32
SyscolumnsIndex2Identifier=177
SysschemasIndex1Identifier=209
SysconglomeratesIndex3Identifier=81
SystablesIndex2Identifier=129
SyscolumnsIndex1Identifier=161
derby.serviceProtocol=org.apache.derby.database.Database
SysschemasIdentifier=192
derby.storage.propertiesId=16
SysconglomeratesIndex2Identifier=65
derby.serviceLocale=en_US
SystablesIdentifier=96
SystablesIndex1Identifier=113
#--- last line, don't put anything after this line ---
18 changes: 18 additions & 0 deletions src/test/java/neqsim/NeqSimTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
*
*/
package neqsim;

import org.junit.jupiter.api.BeforeAll;

/**
* @author ESOL
*
*/
public class NeqSimTest {
public NeqSimTest() {
//Setting NeqSim to use test parameter database
neqsim.util.database.NeqSimDataBase
.setConnectionString("jdbc:derby:classpath:data/neqsimtestdatabase");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @author ESOL
*
*/
class SaturationTemperatureTest {
class SaturationTemperatureTest extends neqsim.NeqSimTest{

/**
* @throws java.lang.Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @version $Id: $Id
* @since 2.2.3
*/
public class NaturalGasCombustion {
public class NaturalGasCombustion extends neqsim.NeqSimTest{
/**
* <p>main.</p>
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package neqsim.fluidMechanics.flowSystem.onePhaseFlowSystem.pipeFlowSystem;

import java.util.Arrays;

import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import neqsim.fluidMechanics.flowSystem.FlowSystemInterface;
import neqsim.thermo.system.SystemInterface;


public class PipeFlowSystemTest {
public class PipeFlowSystemTest extends neqsim.NeqSimTest{
FlowSystemInterface pipe;

@BeforeEach
void setUp() {
pipe = new PipeFlowSystem();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package neqsim.fluidMechanics.util.example;

import org.junit.jupiter.api.BeforeAll;
import neqsim.processSimulation.processEquipment.pipeline.Pipeline;
import neqsim.processSimulation.processEquipment.pipeline.TwoPhasePipeLine;
import neqsim.processSimulation.processEquipment.stream.NeqStream;
Expand All @@ -9,54 +10,57 @@
import neqsim.thermo.system.SystemSrkEos;

/**
* <p>WettedWall_CO2_water class.</p>
* <p>
* WettedWall_CO2_water class.
* </p>
*
* @author asmund
* @version $Id: $Id
* @since 2.2.3
*/
public class WettedWall_CO2_water {
/**
* This method is just meant to test the thermo package.
*
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
SystemInterface testSystem = new SystemSrkEos((273.15 + 5.0), 45.00);
testSystem.addComponent("methane", 0.15, 0);
// testSystem.addComponent("CO2", 0.05, 1);
testSystem.addComponent("n-heptane", 0.5, 1);
testSystem.createDatabase(true);
testSystem.setMixingRule(2);

Stream stream1 = new NeqStream("stream1", testSystem);

Pipeline pipe = new TwoPhasePipeLine("pipe", stream1);

pipe.setOutputFileName("c:/tempNew2.nc");
pipe.setInitialFlowPattern("annular");

int numberOfLegs = 1, numberOfNodesInLeg = 500;
double[] legHeights = {0, 0};
double[] legPositions = {0.0, 1.5};
double[] pipeDiameters = {0.02507588, 0.02507588};
double[] outerTemperature = {295.0, 295.0};
double[] pipeWallRoughness = {1.0e-5, 1.0e-5};
pipe.setNumberOfLegs(numberOfLegs);
pipe.setNumberOfNodesInLeg(numberOfNodesInLeg);
pipe.setLegPositions(legPositions);
pipe.setHeightProfile(legHeights);
pipe.setPipeDiameters(pipeDiameters);
pipe.setPipeWallRoughness(pipeWallRoughness);
pipe.setOuterTemperatures(outerTemperature);
pipe.setEquilibriumMassTransfer(false);
pipe.setEquilibriumHeatTransfer(false);

ProcessSystem operations = new ProcessSystem();
operations.add(stream1);
operations.add(pipe);

operations.run();
operations.displayResult();
}
public class WettedWall_CO2_water extends neqsim.NeqSimTest{

/**
* This method is just meant to test the thermo package.
*
* @param args an array of {@link java.lang.String} objects
*/
public static void main(String args[]) {
SystemInterface testSystem = new SystemSrkEos((273.15 + 5.0), 45.00);
testSystem.addComponent("methane", 0.15, 0);
// testSystem.addComponent("CO2", 0.05, 1);
testSystem.addComponent("n-heptane", 0.5, 1);
testSystem.createDatabase(true);
testSystem.setMixingRule(2);

Stream stream1 = new NeqStream("stream1", testSystem);

Pipeline pipe = new TwoPhasePipeLine("pipe", stream1);

pipe.setOutputFileName("c:/tempNew2.nc");
pipe.setInitialFlowPattern("annular");

int numberOfLegs = 1, numberOfNodesInLeg = 500;
double[] legHeights = {0, 0};
double[] legPositions = {0.0, 1.5};
double[] pipeDiameters = {0.02507588, 0.02507588};
double[] outerTemperature = {295.0, 295.0};
double[] pipeWallRoughness = {1.0e-5, 1.0e-5};
pipe.setNumberOfLegs(numberOfLegs);
pipe.setNumberOfNodesInLeg(numberOfNodesInLeg);
pipe.setLegPositions(legPositions);
pipe.setHeightProfile(legHeights);
pipe.setPipeDiameters(pipeDiameters);
pipe.setPipeWallRoughness(pipeWallRoughness);
pipe.setOuterTemperatures(outerTemperature);
pipe.setEquilibriumMassTransfer(false);
pipe.setEquilibriumHeatTransfer(false);

ProcessSystem operations = new ProcessSystem();
operations.add(stream1);
operations.add(pipe);

operations.run();
operations.displayResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import org.junit.jupiter.api.Test;
import neqsim.thermodynamicOperations.ThermodynamicOperations;

public class FrictionTheoryViscosityMethodTest {
public class FrictionTheoryViscosityMethodTest extends neqsim.NeqSimTest{
static neqsim.thermo.system.SystemInterface testSystem = null;

@BeforeAll
public static void setUp() {
testSystem = new neqsim.thermo.system.SystemSrkEos(273.15 + 25.0, 42.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.jupiter.api.Test;
import neqsim.processSimulation.processEquipment.stream.Stream;

public class SimpleAbsorberTest {
public class SimpleAbsorberTest extends neqsim.NeqSimTest{
neqsim.thermo.system.SystemFurstElectrolyteEos testSystem;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.jupiter.api.Test;
import neqsim.processSimulation.processEquipment.stream.Stream;

public class SimpleAdsorberTest {
public class SimpleAdsorberTest extends neqsim.NeqSimTest{
neqsim.thermo.system.SystemFurstElectrolyteEos testSystem;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;

public class CompressorCalculationTest {
public class CompressorCalculationTest extends neqsim.NeqSimTest{
Compressor comp1;
Stream stream_1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import neqsim.processSimulation.processSystem.ProcessSystem;
import neqsim.thermo.system.SystemSrkEos;

class CompressorPropertyProfileTest {
class CompressorPropertyProfileTest extends neqsim.NeqSimTest{
static neqsim.thermo.system.SystemInterface testSystem = null;

double pressure_inlet = 85.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import neqsim.processSimulation.processSystem.ProcessSystem;
import neqsim.thermo.system.SystemSrkEos;

class CompressorTest {
class CompressorTest extends neqsim.NeqSimTest{
static Logger logger = LogManager.getLogger(CompressorTest.class);

static neqsim.thermo.system.SystemInterface testSystem = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @version $Id: $Id
* @since 2.2.3
*/
public class HeatExchangerTest {
public class HeatExchangerTest extends neqsim.NeqSimTest{
static neqsim.thermo.system.SystemInterface testSystem;
static Stream gasStream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import neqsim.processSimulation.processEquipment.stream.Stream;
import neqsim.thermo.system.SystemSrkEos;

public class GasTurbineTest {
public class GasTurbineTest extends neqsim.NeqSimTest{
static neqsim.thermo.system.SystemInterface testSystem;
static Stream gasStream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @version $Id: $Id
* @since 2.2.3
*/
public class PumpTest {
public class PumpTest extends neqsim.NeqSimTest{
@Test
void testRun() {
neqsim.thermo.system.SystemInterface feedGas =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* @author ESOL
*
*/
class StreamTest {
class StreamTest extends neqsim.NeqSimTest{
static neqsim.thermo.system.SystemInterface testSystem = null;
double pressure_inlet = 85.0;
double temperature_inlet = 35.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import neqsim.processSimulation.processEquipment.valve.ThrottlingValve;
import neqsim.thermo.system.SystemInterface;

public class ProcessSystemRunTransientTest {
public class ProcessSystemRunTransientTest extends neqsim.NeqSimTest{
ProcessSystem p;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil;
import neqsim.processSimulation.processEquipment.valve.ThrottlingValve;

public class ProcessSystemTest {
public class ProcessSystemTest extends neqsim.NeqSimTest{
ProcessSystem p;
String _name = "TestProcess";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;

public class Draft_GERG2004Test {
public class Draft_GERG2004Test extends neqsim.NeqSimTest{
@Disabled
@Test
void testCalculate() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import neqsim.thermo.system.SystemGERGwaterEos;
import neqsim.thermo.system.SystemInterface;

public class Draft_ISO18453Test {
public class Draft_ISO18453Test extends neqsim.NeqSimTest{
@Test
void testCalculate() {
SystemInterface testSystem = new SystemGERGwaterEos(273.15 - 5.0, 20.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import neqsim.thermo.system.SystemInterface;
import neqsim.thermo.system.SystemSrkEos;

public class Standard_ISO6578Test {
public class Standard_ISO6578Test extends neqsim.NeqSimTest{
@Test
void testCalculate() {
SystemInterface testSystem = new SystemSrkEos(273.15 - 160.0, 1.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @author ESOL
*
*/
class Standard_ISO6976Test {
class Standard_ISO6976Test extends neqsim.NeqSimTest{
static SystemInterface testSystem = null;
/**
* @throws java.lang.Exception
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import neqsim.thermo.system.SystemGERGwaterEos;
import neqsim.thermo.system.SystemInterface;

public class BaseContractTest {
public class BaseContractTest extends neqsim.NeqSimTest{
@Test
void testRunCheck() {
SystemInterface testSystem = new SystemGERGwaterEos(273.15 - 5.0, 20.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* @since 2.2.3
* @version $Id: $Id
*/
public class TestLevenbergMarquardt_MonteCarlo {
public class TestLevenbergMarquardt_MonteCarlo extends neqsim.NeqSimTest{
/**
* <p>main.</p>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @since 2.2.3
* @version $Id: $Id
*/
public class TestLevenbergMarquardt {
public class TestLevenbergMarquardt extends neqsim.NeqSimTest{
/**
* <p>
* main.
Expand Down
Loading

0 comments on commit 022bc2c

Please sign in to comment.