Skip to content

Commit

Permalink
Rename package and artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
LeonBein committed Aug 21, 2024
1 parent 55cdcf1 commit ad1a450
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 49 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<modelVersion>4.0.0</modelVersion>


<groupId>de.hpi.bpt</groupId>
<artifactId>cost_driver</artifactId>
<groupId>de.tum.insm.scylla.plugin</groupId>
<artifactId>sopa</artifactId>
<version>0.1.2-SNAPSHOT</version>
<packaging>jar</packaging>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import org.springframework.lang.NonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.exception.ScyllaValidationException;
import org.springframework.lang.NonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import org.springframework.lang.NonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.logger.ProcessNodeInfo;
import de.hpi.bpt.scylla.logger.ProcessNodeTransitionType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.exception.ScyllaValidationException;
import de.hpi.bpt.scylla.model.global.GlobalConfiguration;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

public class CostDriverPluginUtils {
static final String PLUGIN_NAME = "cost_driver";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import org.springframework.lang.NonNull;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.exception.ScyllaValidationException;
import org.springframework.lang.NonNull;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.Scylla;
import de.hpi.bpt.scylla.plugin_loader.PluginLoader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.SimulationTest;
import de.hpi.bpt.scylla.plugin_loader.PluginLoader;
Expand All @@ -11,9 +11,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;

import static cost_driver.Utils.*;
import static de.hpi.bpt.scylla.Scylla.normalizePath;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
Expand All @@ -28,22 +26,22 @@ void testWriteToLog() throws IOException {
PluginLoader.getDefaultPluginLoader().activateNone().loadPackage(Main.class.getPackageName());
setGlobalSeed(-7870005462812540457L);
runSimpleSimulation(
GLOBAL_CONFIGURATION_FILE,
SIMULATION_MODEL_FILE,
SIMULATION_CONFIGURATION_FILE);
Utils.GLOBAL_CONFIGURATION_FILE,
Utils.SIMULATION_MODEL_FILE,
Utils.SIMULATION_CONFIGURATION_FILE);

String expectedFileNameXML = normalizePath("./" + outputPath + "sustainability_global_information_statistic.xml");
String expectedFileNameXES = normalizePath("./" + outputPath + SIMULATION_MODEL_FILE);
String expectedFileNameXES = normalizePath("./" + outputPath + Utils.SIMULATION_MODEL_FILE);
Path filePathXML = Paths.get(expectedFileNameXML);
Path filePathXES = Paths.get(expectedFileNameXES.substring(0, expectedFileNameXES.lastIndexOf('.')).concat(".xes"));

// Read the content of both XML files as strings
String actualXML = new String(Files.readAllBytes(filePathXML));
String expectedXML = new String(Files.readAllBytes(Paths.get(normalizePath("./" + TEST_PATH + "/cost_driver_output/" + "sustainability_global_information_statistic.xml"))));
String expectedXML = new String(Files.readAllBytes(Paths.get(normalizePath("./" + Utils.TEST_PATH + "/cost_driver_output/" + "sustainability_global_information_statistic.xml"))));

// Read the content of both XES files as strings
String actualXES = new String(Files.readAllBytes(filePathXES));
String expectedXES = new String(Files.readAllBytes(Paths.get(normalizePath("./" + TEST_PATH + "/cost_driver_output/" + "logistics_model_no_drivers.xes"))));
String expectedXES = new String(Files.readAllBytes(Paths.get(normalizePath("./" + Utils.TEST_PATH + "/cost_driver_output/" + "logistics_model_no_drivers.xes"))));

// Compare the XML files
Diff diffXML = DiffBuilder.compare(expectedXML).withTest(actualXML)
Expand Down Expand Up @@ -73,13 +71,13 @@ void testCorrectFileExtensionXES() throws IOException {
PluginLoader.getDefaultPluginLoader().activateNone().loadPackage(Main.class.getPackageName());

runSimpleSimulation(
GLOBAL_CONFIGURATION_FILE,
SIMULATION_MODEL_FILE,
SIMULATION_CONFIGURATION_FILE);
Utils.GLOBAL_CONFIGURATION_FILE,
Utils.SIMULATION_MODEL_FILE,
Utils.SIMULATION_CONFIGURATION_FILE);
// By default is false
EXECUTION_LOGGING_PLUGIN.gzipOn = false;

String expectedFileName = normalizePath("./" + outputPath + SIMULATION_MODEL_FILE);
String expectedFileName = normalizePath("./" + outputPath + Utils.SIMULATION_MODEL_FILE);
Path filePath = Paths.get(expectedFileName.substring(0, expectedFileName.lastIndexOf('.')).concat(".xes"));
assertTrue(Files.exists(filePath), "XES File does not exist: " + filePath);
assertTrue(filePath.toString().endsWith(".xes"), "File extension is not .xes: " + filePath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.SimulationTest;
import de.hpi.bpt.scylla.exception.ScyllaValidationException;
Expand All @@ -12,7 +12,6 @@
import java.util.ArrayList;
import java.util.List;

import static cost_driver.Utils.*;
import static org.junit.jupiter.api.Assertions.fail;

//@SuppressWarnings("unchecked")
Expand All @@ -24,17 +23,17 @@ void testParse_GC() throws IOException, ScyllaValidationException, JDOMException
PluginLoader.getDefaultPluginLoader().activateNone().loadPackage(Main.class.getPackageName());

runSimpleSimulation(
GLOBAL_CONFIGURATION_FILE,
SIMULATION_MODEL_FILE,
SIMULATION_CONFIGURATION_FILE);
Utils.GLOBAL_CONFIGURATION_FILE,
Utils.SIMULATION_MODEL_FILE,
Utils.SIMULATION_CONFIGURATION_FILE);

// Integrate the ACDs
Object obj = getGlobalConfiguration().getExtensionAttributes().get("cost_driver_costDrivers");

if (obj instanceof ArrayList<?> list) {
if (list.stream().allMatch(element -> element instanceof AbstractCostDriver)) {
List<AbstractCostDriver> abstractCostDriverList = (ArrayList<AbstractCostDriver>) list;
var expected = parseGC();
var expected = Utils.parseGC();
for (int i = 0; i < abstractCostDriverList.size(); i++) {
if (!abstractCostDriverList.get(i).equals(expected.get(i))) {
fail("\nWrongly parsed ACD: " +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.SimulationTest;
import de.hpi.bpt.scylla.exception.ScyllaValidationException;
Expand All @@ -11,7 +11,6 @@
import java.io.IOException;
import java.util.*;

import static cost_driver.Utils.*;
import static org.junit.jupiter.api.Assertions.assertEquals;

class SCParserTest extends SimulationTest {
Expand All @@ -24,9 +23,9 @@ void testParsingActivityCostDrivers() throws IOException, ScyllaValidationExcept
PluginLoader.getDefaultPluginLoader().activateNone().loadPackage(Main.class.getPackageName());

runSimpleSimulation(
GLOBAL_CONFIGURATION_FILE,
SIMULATION_MODEL_FILE,
SIMULATION_CONFIGURATION_FILE);
Utils.GLOBAL_CONFIGURATION_FILE,
Utils.SIMULATION_MODEL_FILE,
Utils.SIMULATION_CONFIGURATION_FILE);

//TODO insert proper fixture
Map<String, Integer> identifiersToNodeIds = simulationManager.getProcessModels().get("Process_0vv8a1n").getIdentifiersToNodeIds();
Expand All @@ -51,7 +50,7 @@ void testParsingActivityCostDrivers() throws IOException, ScyllaValidationExcept
void testParsingVariants() throws IOException, ScyllaValidationException, JDOMException {
PluginLoader.getDefaultPluginLoader().activateNone().loadPackage(Main.class.getPackageName());

setGlobalSeed(DEFAULT_SEED);
setGlobalSeed(Utils.DEFAULT_SEED);

afterParsing(() -> { //Needs to be run directly after parsing, as stack of calculated variants is consumed during simulation
SimulationConfiguration actualSimConfig = getSimulationConfiguration();
Expand All @@ -69,9 +68,9 @@ void testParsingVariants() throws IOException, ScyllaValidationException, JDOMEx
});

runSimpleSimulation(
GLOBAL_CONFIGURATION_FILE,
SIMULATION_MODEL_FILE,
SIMULATION_CONFIGURATION_FILE);
Utils.GLOBAL_CONFIGURATION_FILE,
Utils.SIMULATION_MODEL_FILE,
Utils.SIMULATION_CONFIGURATION_FILE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.SimulationManager;
import de.hpi.bpt.scylla.plugin_loader.PluginLoader;
Expand All @@ -18,8 +18,6 @@
import java.util.List;
import java.util.Objects;

import static cost_driver.Utils.*;

/**
* This class contains various useful scripts for the programmatic usage of scylla.<br>
* These are results from previous usages of the system
Expand All @@ -41,9 +39,9 @@ public static void runMoockModels() throws IOException {

int[] clerkCountsToTest = new int[]{4};
int numInstances = 10;
String globalConf = TEST_PATH + GLOBAL_CONFIGURATION_FILE;
String model = TEST_PATH + SIMULATION_MODEL_FILE;
String simConf = TEST_PATH + SIMULATION_CONFIGURATION_FILE;
String globalConf = Utils.TEST_PATH + Utils.GLOBAL_CONFIGURATION_FILE;
String model = Utils.TEST_PATH + Utils.SIMULATION_MODEL_FILE;
String simConf = Utils.TEST_PATH + Utils.SIMULATION_CONFIGURATION_FILE;

try {
SAXBuilder builder = new SAXBuilder();
Expand Down Expand Up @@ -83,7 +81,7 @@ public static void runMoockModels() throws IOException {
globalConf,
model,
simConf,
TEST_PATH + numClerks + "_" + numInstances + "_" + new SimpleDateFormat("yy_MM_dd_HH_mm_ss_SSS").format(new Date()) + "/");
Utils.TEST_PATH + numClerks + "_" + numInstances + "_" + new SimpleDateFormat("yy_MM_dd_HH_mm_ss_SSS").format(new Date()) + "/");

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package cost_driver;
package de.tum.insm.scylla.plugin.sopa;

import de.hpi.bpt.scylla.exception.ScyllaValidationException;
import org.jdom2.Document;
Expand All @@ -8,7 +8,6 @@

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down

0 comments on commit ad1a450

Please sign in to comment.