diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index 2829dc1..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,57 +0,0 @@
-name: build-annotations
-on:
- push:
- branches-ignore:
- - 'dependabot/**' #avoid duplicates: only run the PR, not the commit
- - 'gh-pages' #GitHub pages do not trigger all tests
- tags-ignore:
- - 'v*' #avoid rerun existing commit on release
- pull_request:
- branches:
- - 'main'
-jobs:
- test-java:
- runs-on: ubuntu-latest
- # if: ${{ false }} # disable for now
- steps:
- - uses: actions/checkout@v4
- - uses: actions/setup-java@v4
- with:
- distribution: 'temurin'
- java-version: '16'
- cache: 'maven'
-
- - name: Build Annotation project
- run: mvn compile -U --no-transfer-progress
-
-
- sonarqube:
- needs: [ test-java ]
- #if: ${{ false }} # disable for now
- #This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons).
- #Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4
- if: ${{ github.actor != 'dependabot[bot]' }}
- runs-on: ubuntu-latest
- steps:
- - uses: javiertuya/sonarqube-action@v1.4.0
- with:
- github-token: ${{ secrets.GITHUB_TOKEN }}
- sonar-token: ${{ secrets.SONAR_TOKEN }}
-
- publish-java-snapshot:
- #if: ${{ false }} # disable for now
- #avoid publishing PRs and dependabot branches
- if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }}
- runs-on: ubuntu-latest
- permissions:
- contents: read
- packages: write
- steps:
- - uses: javiertuya/branch-snapshots-action@v1.2.3
- with:
- token: ${{ secrets.GITHUB_TOKEN }}
- java-version: '16'
- mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress'
- delete-old-snapshots: true
- min-snapshots-to-keep: 2
- always-keep-regex: "\\d*\\.\\d*\\.\\d*-main-SNAPSHOT$"
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 0000000..ce08c48
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,119 @@
+name: build-retorch
+on:
+ push:
+ branches-ignore:
+ - 'dependabot/**' #avoid duplicates: only run the PR, not the commit
+ - 'gh-pages' #GitHub pages do not trigger all tests
+ tags-ignore:
+ - 'v*' #avoid rerun existing commit on release
+ pull_request:
+ branches:
+ - 'main'
+jobs:
+ build-java:
+ runs-on: ubuntu-latest
+ # if: ${{ false }} # disable for now
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: '16'
+ cache: 'maven'
+
+ - name: Build RETORCH project
+ run: mvn compile -U --no-transfer-progress
+
+ test-retorch-orchestration:
+ runs-on: ubuntu-latest
+ # if: ${{ false }} # disable for now
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v4
+ with:
+ distribution: 'temurin'
+ java-version: '16'
+ cache: 'maven'
+
+ - name: Test RETORCH orchestration module
+ run: mvn test -Dtest=* -pl retorch-orchestration -U --no-transfer-progress
+
+ - name: Generate report checks
+ if: always()
+ uses: mikepenz/action-junit-report@v5
+ with:
+ check_name: "test-result-orchestration"
+ report_paths: "**/surefire-reports/TEST-*.xml"
+ fail_on_failure: 'true'
+
+ - if: always()
+ name: Publish test report files
+ uses: actions/upload-artifact@v4
+ with:
+ name: "test-report-files-orchestration"
+ path: |
+ target/site
+ **/target/site/jacoco/jacoco.xml
+ **/target/surefire-reports
+
+ sonarqube:
+ needs: [ build-java, test-retorch-orchestration ]
+ #if: ${{ false }} # disable for now
+ #This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons).
+ #Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4
+ if: ${{ github.actor != 'dependabot[bot]' }}
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/download-artifact@v4.1.8
+ if: always()
+ with:
+ name: "test-report-files-orchestration"
+ - name: Aggregated junit html report
+ if: always()
+ uses: javiertuya/junit-report-action@v1.2.0
+ with:
+ surefire-files: "**/target/surefire-reports/TEST-*.xml"
+ report-dir: target-ALL/site
+ report-title: "Test Report: ALL - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}"
+ - name: Index file to html reports
+ run: |
+ echo "
Latest Test Reports
" > target-ALL/site/index.html
+ echo "Latest Test Reports - Branch: ${{ github.ref_name }} - Run #${{ github.run_number }}
" >> target-ALL/site/index.html
+ echo "Single page reports
" >> target-ALL/site/index.html
+ echo "Multiple page reports with frames
" >> target-ALL/site/index.html
+ echo "" >> target-ALL/site/index.html
+ - if: always()
+ name: Publish test report files
+ uses: actions/upload-artifact@v4
+ with:
+ name: "test-report-ALL"
+ path: |
+ target-ALL/site
+ **/target/surefire-reports
+ **/target/*.html
+ **/target/*.log
+ **/reports/*.html
+ **/reports/*.log
+ - uses: javiertuya/sonarqube-action@v1.4.0
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ sonar-token: ${{ secrets.SONAR_TOKEN }}
+ restore-artifact-name1: "test-report-files-orchestration"
+
+ publish-java-snapshot:
+ #if: ${{ false }} # disable for now
+ #avoid publishing PRs and dependabot branches
+ if: ${{ github.event_name != 'pull_request' && !startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/dashgit/combined/') }}
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ packages: write
+ steps:
+ - uses: javiertuya/branch-snapshots-action@v1.2.3
+ with:
+ token: ${{ secrets.GITHUB_TOKEN }}
+ java-version: '16'
+ mvn-deploy-args: '-P publish-github -DskipTests=true -Dmaven.test.failure.ignore=false -U --no-transfer-progress'
+ delete-old-snapshots: true
+ min-snapshots-to-keep: 2
+ always-keep-regex: "\\d*\\.\\d*\\.\\d*-main-SNAPSHOT$"
diff --git a/pom.xml b/pom.xml
index a0ded23..4880e45 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,6 +19,10 @@
16
16
UTF-8
+
+
+ 1.5.12
+
@@ -39,6 +43,12 @@
slf4j-api
2.0.16
+
+ ch.qos.logback
+ logback-classic
+ ${logback-classic.version}
+ test
+
diff --git a/retorch-orchestration/pom.xml b/retorch-orchestration/pom.xml
index e1e08e6..ce86d51 100644
--- a/retorch-orchestration/pom.xml
+++ b/retorch-orchestration/pom.xml
@@ -8,26 +8,40 @@
retorch-orchestration
jar
retorch-orchestration
- Multimodule maven project template, module without dependencies
- http://github.com/giis-uniovi/samples-giis-template
+ This module covers the orchestration process, processes the Resource annotations and generates the necessary
+ scripting code to execute the RETORCH execution plan
+ https://github.com/giis-uniovi/retorch
Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES
- http://giis.uniovi.es/
+ https://giis.uniovi.es/
+ 1.1.1-SNAPSHOT
+
+ 3.5.2
+
2.18.1
5.14.2
- 1.5.12
+
+
+ io.github.giis-uniovi
+ retorch-annotations
+ ${retorchannotations.version}
+
org.slf4j
slf4j-api
+
+ ch.qos.logback
+ logback-classic
+
junit
junit
@@ -43,17 +57,6 @@
${mockito.version}
test
-
- ch.qos.logback
- logback-classic
- ${logback-classic.version}
- test
-
-
- io.github.giis-uniovi
- retorch-annotations
- 1.1.1-SNAPSHOT
-
@@ -85,6 +88,21 @@
16
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ ${maven-surefire-plugin.version}
+
+
+ **/testdata/**
+
+
+ true
+ true
+
+ false
+
+
\ No newline at end of file
diff --git a/retorch-orchestration/retorchfiles/configurations/retorchCI.properties b/retorch-orchestration/retorchfiles/configurations/retorchCI.properties
deleted file mode 100644
index dadcf41..0000000
--- a/retorch-orchestration/retorchfiles/configurations/retorchCI.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-agentCIName=any
-sut-wait-html=FullTeaching
-sut-location=$WORKSPACE
-docker-frontend-name=https://full-teaching-
-docker-frontend-port=5000
-external-binded-port=
-external-frontend-url=
-testsBasePath=somepath/somedir/
\ No newline at end of file
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessMode.java
similarity index 50%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessMode.java
index e0cf7fe..ab8dc24 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessMode.java
@@ -1,30 +1,30 @@
package giis.retorch.orchestration.model;
-public class AccessModeEntity {
+public class AccessMode {
- private AccessModeTypesEntity accessMode;
+ private AccessModeTypes type;
private boolean sharing = false;
private int concurrency = 1;
- private ResourceEntity resource;
+ private Resource resource;
- public AccessModeEntity() {}
+ public AccessMode() {}
- public AccessModeEntity(AccessModeEntity accessMode) {
- this.accessMode = accessMode.getAccessMode();
- this.concurrency = accessMode.getConcurrency();
- this.resource = accessMode.getResource();
- this.sharing = accessMode.getSharing();
+ public AccessMode(AccessMode type) {
+ this.type = type.getType();
+ this.concurrency = type.getConcurrency();
+ this.resource = type.getResource();
+ this.sharing = type.getSharing();
}
/**
* Access mode constructor
- * @param accessMode {@link AccessModeTypesEntity} that could be READONLY,WRITEONLY,READWRITE,DYNAMIC or NOACCESS
+ * @param type {@link AccessModeTypes} that could be READONLY,WRITEONLY,READWRITE,DYNAMIC or NOACCESS
* @param sharing Boolean that represents if the resource can be shared or not
* @param concurrency Integer with the max number of concurrent access
* @param resource Resource on which the access mode is performed
*/
- public AccessModeEntity(AccessModeTypesEntity accessMode, boolean sharing, int concurrency, ResourceEntity resource) {
- this.accessMode = accessMode;
+ public AccessMode(AccessModeTypes type, boolean sharing, int concurrency, Resource resource) {
+ this.type = type;
this.sharing = sharing;
this.concurrency = concurrency;
this.resource = resource;
@@ -38,24 +38,24 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if ((obj == null) || (!obj.getClass().equals(this.getClass()))) return false;
- AccessModeEntity objToCompare = ((AccessModeEntity) obj);
+ AccessMode objToCompare = ((AccessMode) obj);
return objToCompare.getSharing() == this.sharing && objToCompare.getConcurrency() == this.concurrency
- && objToCompare.getAccessMode().equals(this.accessMode) && objToCompare.getResource().equals(this.resource);
+ && objToCompare.getType().equals(this.type) && objToCompare.getResource().equals(this.resource);
}
@Override
public String toString() {
- return "a.m.{" + accessMode + ", " + sharing + ", " + concurrency + ",'" + resource + '\'' + '}';
+ return "a.m.{" + type + ", " + sharing + ", " + concurrency + ",'" + resource + '\'' + '}';
}
- public AccessModeTypesEntity getAccessMode() {
- return accessMode;
+ public AccessModeTypes getType() {
+ return type;
}
public int getConcurrency() {
return concurrency;
}
- public ResourceEntity getResource() {
+ public Resource getResource() {
return resource;
}
public boolean getSharing() {
@@ -65,14 +65,14 @@ public boolean getSharing() {
public void setSharing(boolean sharing) {
this.sharing = sharing;
}
- public void setResource(ResourceEntity resource) {
+ public void setResource(Resource resource) {
this.resource = resource;
}
public void setConcurrency(int concurrency) {
this.concurrency = concurrency;
}
- public void setAccessMode(AccessModeTypesEntity accessMode) {
- this.accessMode = accessMode;
+ public void setType(AccessModeTypes type) {
+ this.type = type;
}
}
\ No newline at end of file
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypesEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypes.java
similarity index 92%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypesEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypes.java
index 13c9f56..f9577ce 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypesEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/AccessModeTypes.java
@@ -4,7 +4,7 @@
* This class is used as AccessMode parser for given a string representation of a RETORCH access mode (i.e:
* READONLY,READWRITE...) convert it into the proper enumeration. Also provides
*/
-public class AccessModeTypesEntity {
+public class AccessModeTypes {
public enum type {READONLY, READWRITE, WRITEONLY, DYNAMIC, NOACCESS}
@@ -12,7 +12,7 @@ public enum type {READONLY, READWRITE, WRITEONLY, DYNAMIC, NOACCESS}
private type accessModeType;
- public AccessModeTypesEntity(String typeOfAccess) {
+ public AccessModeTypes(String typeOfAccess) {
this.accessStringType = typeOfAccess;
switch (typeOfAccess) {
case "READONLY":
@@ -47,7 +47,7 @@ public String toString() {
@Override
public boolean equals(Object obj) {
if ((obj == null)||(!obj.getClass().equals(this.getClass()))) return false;
- AccessModeTypesEntity currentType = ((AccessModeTypesEntity) obj);
+ AccessModeTypes currentType = ((AccessModeTypes) obj);
return currentType.getAccessModeType() == this.getAccessModeType();
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/CapacityEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Capacity.java
similarity index 91%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/CapacityEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Capacity.java
index e04dd42..01172cd 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/CapacityEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Capacity.java
@@ -15,9 +15,9 @@
* are supported are specified in {@code CapacityTypes}: memory, processor,slots and storage.
* If the provided name is not in the list of valid capacities, it defaults to "Wrong Capacity".
*/
-public class CapacityEntity {
+public class Capacity {
- private static final Logger log = LoggerFactory.getLogger(CapacityEntity.class);
+ private static final Logger log = LoggerFactory.getLogger(Capacity.class);
public static final String MEMORY_NAME = "memory";
public static final String PROCESSOR_NAME = "processor";
public static final String SLOTS_NAME = "slots";
@@ -29,7 +29,7 @@ public class CapacityEntity {
protected static final Set LIST_CAPACITIES = new HashSet<>();
static {Collections.addAll(LIST_CAPACITIES, MEMORY_NAME, PROCESSOR_NAME, SLOTS_NAME, STORAGE_NAME);}
- public CapacityEntity(@JsonProperty("name") String name, @JsonProperty("quantity") double quantity) {
+ public Capacity(@JsonProperty("name") String name, @JsonProperty("quantity") double quantity) {
if (LIST_CAPACITIES.contains(name)) {
setName(name);
} else {
@@ -53,7 +53,7 @@ public String toString() {
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
- CapacityEntity that = (CapacityEntity) o;
+ Capacity that = (Capacity) o;
return Objects.equals(this.getName(), that.getName()) && Objects.equals(this.getQuantity(), that.getQuantity());
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModelEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModel.java
similarity index 79%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModelEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModel.java
index 9d8e2ac..b05754a 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModelEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ElasticityModel.java
@@ -2,13 +2,13 @@
import com.fasterxml.jackson.annotation.JsonProperty;
-public class ElasticityModelEntity {
+public class ElasticityModel {
private String elasticityID;
private int elasticity;
private double elasticityCost;
- public ElasticityModelEntity(String idElasticity) {this.elasticityID = idElasticity;}
+ public ElasticityModel(String idElasticity) {this.elasticityID = idElasticity;}
/**
* Elasticity model constructor
@@ -16,9 +16,9 @@ public class ElasticityModelEntity {
* @param elasticityCost Double with the cost of one instance deployment
* @param elasticityID String with the ElasticityID
*/
- public ElasticityModelEntity(@JsonProperty("elasticityID") String elasticityID,
- @JsonProperty("elasticity") int elasticity,
- @JsonProperty("elasticityCost") double elasticityCost) {
+ public ElasticityModel(@JsonProperty("elasticityID") String elasticityID,
+ @JsonProperty("elasticity") int elasticity,
+ @JsonProperty("elasticityCost") double elasticityCost) {
this.elasticityID = elasticityID;
this.elasticity = elasticity;
this.elasticityCost = elasticityCost;
@@ -37,7 +37,7 @@ public String toString() {
@Override
public boolean equals(Object obj) {
if ((obj == null) ||(!obj.getClass().equals(this.getClass()))) return false;
- ElasticityModelEntity currentType = ((ElasticityModelEntity) obj);
+ ElasticityModel currentType = ((ElasticityModel) obj);
return currentType.getElasticity() == this.elasticity && currentType.getElasticityCost() == this.elasticityCost &&
currentType.getElasticityID().equals(this.getElasticityID());
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Resource.java
similarity index 69%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Resource.java
index 6ff9778..45434cb 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/Resource.java
@@ -10,29 +10,29 @@
import java.util.LinkedList;
import java.util.List;
-public class ResourceEntity {
+public class Resource {
public enum type {PHYSICAL, LOGICAL, COMPUTATIONAL}
- private final Logger logResourceClass=LoggerFactory.getLogger(ResourceEntity.class);
+ private final Logger logResourceClass = LoggerFactory.getLogger(Resource.class);
Marker errorMarker = MarkerFactory.getMarker("Error");
private String resourceID;
private List hierarchyParent;
private List replaceable;
- private List minimalCapacities;
- private ElasticityModelEntity elasticityModel;
+ private List minimalCapacities;
+ private ElasticityModel elasticityModel;
private type resourceType = type.LOGICAL;
private String dockerImage;
- public ResourceEntity(String resourceID) {
+ public Resource(String resourceID) {
super();
this.resourceID = resourceID;
this.replaceable = new LinkedList<>();
this.hierarchyParent = new LinkedList<>();
}
- public ResourceEntity() {}
+ public Resource() {}
/**
* Resource constructor
@@ -41,16 +41,16 @@ public ResourceEntity() {}
* @param replaceable List with the ids of those resources that could replace the resource
* @param resourceType type of the resource (LOGICAL, PHYSICAL or COMPUTATIONAL)
* @param hierarchyParent String with the resource hierarchical parent
- * @param minimalCapacities List with the minimal {@link CapacityEntity} required by the resource
+ * @param minimalCapacities List with the minimal {@link Capacity} required by the resource
* @param dockerImage String with the Resource docker image name
*/
- public ResourceEntity(@JsonProperty("resourceId") String resourceID,
- @JsonProperty("hierarchyParent") List hierarchyParent,
- @JsonProperty("replaceable") List replaceable,
- @JsonProperty("elasticityModel") ElasticityModelEntity elasticityModel,
- @JsonProperty("resourceType") type resourceType,
- @JsonProperty("minimalCapacities")List minimalCapacities,
- @JsonProperty("dockerImage") String dockerImage) {
+ public Resource(@JsonProperty("resourceId") String resourceID,
+ @JsonProperty("hierarchyParent") List hierarchyParent,
+ @JsonProperty("replaceable") List replaceable,
+ @JsonProperty("elasticityModel") ElasticityModel elasticityModel,
+ @JsonProperty("resourceType") type resourceType,
+ @JsonProperty("minimalCapacities")List minimalCapacities,
+ @JsonProperty("dockerImage") String dockerImage) {
this.resourceID = resourceID;
this.hierarchyParent = hierarchyParent;
this.replaceable = replaceable;
@@ -60,17 +60,17 @@ public ResourceEntity(@JsonProperty("resourceId") String resourceID,
this.dockerImage=dockerImage;
}
- public ResourceEntity(ResourceEntity resourceEntity) {
- this.dockerImage = resourceEntity.dockerImage;
- this.elasticityModel = resourceEntity.getElasticityModel();
- this.errorMarker = resourceEntity.errorMarker;
+ public Resource(Resource resource) {
+ this.dockerImage = resource.dockerImage;
+ this.elasticityModel = resource.getElasticityModel();
+ this.errorMarker = resource.errorMarker;
this.hierarchyParent = new LinkedList<>();
- this.hierarchyParent.addAll(resourceEntity.getHierarchyParent());
- this.minimalCapacities = resourceEntity.getMinimalCapacities();
+ this.hierarchyParent.addAll(resource.getHierarchyParent());
+ this.minimalCapacities = resource.getMinimalCapacities();
this.replaceable = new LinkedList<>();
- this.replaceable.addAll(resourceEntity.getReplaceable());
- this.resourceID = resourceEntity.getResourceID();
- this.resourceType = resourceEntity.getResourceType();
+ this.replaceable.addAll(resource.getReplaceable());
+ this.resourceID = resource.getResourceID();
+ this.resourceType = resource.getResourceType();
}
@Override
@@ -88,7 +88,7 @@ public String toString() {
public boolean equals(Object obj) {
String message;
if (obj == null || !obj.getClass().equals(this.getClass())) return false;
- ResourceEntity resClass = (ResourceEntity) obj;
+ Resource resClass = (Resource) obj;
if (!this.elasticityModel.equals(resClass.elasticityModel)) {
if (this.elasticityModel.getElasticityID().equals(resClass.elasticityModel.getElasticityID())){
message=String.format("The elasticityModel of the resources with the same identifier " + "%s differ", resClass.getResourceID());
@@ -102,9 +102,9 @@ public boolean equals(Object obj) {
}
public String getDockerImage() {return dockerImage;}
- public ElasticityModelEntity getElasticityModel() {return elasticityModel;}
+ public ElasticityModel getElasticityModel() {return elasticityModel;}
public List getHierarchyParent() {return hierarchyParent;}
- public List getMinimalCapacities() {return minimalCapacities;}
+ public List getMinimalCapacities() {return minimalCapacities;}
public String getResourceID() {return resourceID;}
public type getResourceType() {return resourceType;}
public List getReplaceable() {
@@ -113,10 +113,10 @@ public List getReplaceable() {
}
public void setDockerImage(String dockerImage) {this.dockerImage = dockerImage;}
- public void setElasticityModel(ElasticityModelEntity elasticityModel) {this.elasticityModel = elasticityModel;}
+ public void setElasticityModel(ElasticityModel elasticityModel) {this.elasticityModel = elasticityModel;}
public void setHierarchyParent(List hierarchyParent) {this.hierarchyParent = hierarchyParent;}
- public void setMinimalCapacities(List minimalCapacities) {
- minimalCapacities.sort(Comparator.comparing(CapacityEntity::getName));
+ public void setMinimalCapacities(List minimalCapacities) {
+ minimalCapacities.sort(Comparator.comparing(Capacity::getName));
this.minimalCapacities = minimalCapacities;
}
public void setReplaceable(List replaceable) {this.replaceable = replaceable;}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstanceEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstance.java
similarity index 82%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstanceEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstance.java
index e9d66bb..83586d9 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstanceEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/ResourceInstance.java
@@ -9,9 +9,9 @@
* It provides methods to get and set the name and capacities, and overrides the {@code equals}, {@code hashCode},
* and {@code toString} methods for comparison and representation purposes taking into account the list of capacities.
*/
-public class ResourceInstanceEntity extends ResourceEntity {
+public class ResourceInstance extends Resource {
- public ResourceInstanceEntity(String name, List capacities) {
+ public ResourceInstance(String name, List capacities) {
this.setMinimalCapacities(capacities);
this.setResourceID(name);
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/SystemEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/System.java
similarity index 62%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/SystemEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/System.java
index 9e834c0..4fd462c 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/SystemEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/System.java
@@ -8,15 +8,15 @@
import java.util.LinkedList;
import java.util.List;
-public class SystemEntity {
+public class System {
- private static final Logger logSystemClass = LoggerFactory.getLogger(SystemEntity.class);
+ private static final Logger logSystemClass = LoggerFactory.getLogger(System.class);
private final String name;
- private final LinkedList resources;
- private final List testCases;
+ private final LinkedList resources;
+ private final List testCases;
- public SystemEntity(String name) {
+ public System(String name) {
this.name = name;
this.testCases = new LinkedList<>();
this.resources = new LinkedList<>();
@@ -30,7 +30,7 @@ public int hashCode() {
@Override
public boolean equals(Object obj) {
if ((obj == null)||(!obj.getClass().equals(this.getClass()))) return false;
- SystemEntity objectToCompare = ((SystemEntity) obj);
+ System objectToCompare = ((System) obj);
if (!objectToCompare.getName().equals(this.name)) return false;
boolean containAllResources = new HashSet<>(objectToCompare.getResources()).containsAll(this.getResources());
boolean containsAllTestCases = new HashSet<>(objectToCompare.getTestCases()).containsAll(this.getTestCases());
@@ -41,40 +41,40 @@ public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("System ID: ").append(getName()).append("\n");
sb.append("Resources:\n");
- for (ResourceEntity res : getResources()){
+ for (Resource res : getResources()){
sb.append("\t").append(res).append("\n");
}
sb.append("TestCases:\n");
- for (TestCaseEntity tc : getTestCases()){
+ for (TestCase tc : getTestCases()){
sb.append("\t").append(tc).append("\n");
}
return sb.toString();
}
public String getName() {return name;}
- public List getResources() {return resources;}
- public List getTestCases() {return testCases;}
+ public List getResources() {return resources;}
+ public List getTestCases() {return testCases;}
- public void addTestCase(TestCaseEntity test) {
+ public void addTestCase(TestCase test) {
this.testCases.add(test);
- this.testCases.sort(Comparator.comparing(TestCaseEntity::getName));
+ this.testCases.sort(Comparator.comparing(TestCase::getName));
}
- public void addListOfResources(List listResources) {
+ public void addListOfResources(List listResources) {
this.resources.addAll(listResources);
- this.resources.sort(Comparator.comparing(ResourceEntity::getResourceID));
+ this.resources.sort(Comparator.comparing(Resource::getResourceID));
}
- public void addResourceClass(ResourceEntity resource) {
+ public void addResourceClass(Resource resource) {
if (!this.resources.contains(resource)) {
this.resources.add(resource);
} else logSystemClass.info("The resource {} is contained in the system", resource.getResourceID());
- this.resources.sort(Comparator.comparing(ResourceEntity::getResourceID));
+ this.resources.sort(Comparator.comparing(Resource::getResourceID));
}
- public void addListTestCases(List listTestCases) {
+ public void addListTestCases(List listTestCases) {
this.testCases.addAll(listTestCases);
- this.testCases.sort(Comparator.comparing(TestCaseEntity::getName));
+ this.testCases.sort(Comparator.comparing(TestCase::getName));
}
}
\ No newline at end of file
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJobEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJob.java
similarity index 76%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJobEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJob.java
index a207ab7..2477dff 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJobEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TJob.java
@@ -10,11 +10,11 @@
* When the TJob is created, it calculates the total amount of {@code Capacity} that is used by the list of
* {@code ResourceClass} required
*/
-public class TJobEntity {
+public class TJob {
private final Logger log = LoggerFactory.getLogger(this.getClass());
- private Set totalCapacities;
+ private Set totalCapacities;
private int stage;
private double startSetUp;
private double endSetUp;
@@ -22,8 +22,8 @@ public class TJobEntity {
private double endExec;
private double startTearDown;
private double endTearDown;
- private List listTestCases;
- private List listResourceEntities;
+ private List listTestCases;
+ private List listResourceEntities;
private String idTJob = "Default";
private String intraTJobSchedule = "SequentialScheduling";
private Integer tJobConcurrency=50;
@@ -47,38 +47,38 @@ public class TJobEntity {
* new test
* case is added.
*/
- public TJobEntity() {
+ public TJob() {
this.listResourceEntities = new LinkedList<>();
this.listTestCases = new LinkedList<>();
}
- public TJobEntity(String idTJob, int stage, List resourceInstances) {
+ public TJob(String idTJob, int stage, List resourceInstances) {
//Attributes required by the tool
this.listTestCases=new LinkedList<>();
//Attributes required for the cost model
this.idTJob = idTJob;
this.listResourceEntities = resourceInstances;
this.stage = stage;
- CapacityEntity memory = new CapacityEntity(CapacityEntity.MEMORY_NAME, 0);
- CapacityEntity processors = new CapacityEntity(CapacityEntity.PROCESSOR_NAME, 0);
- CapacityEntity slots = new CapacityEntity(CapacityEntity.SLOTS_NAME, 0);
- CapacityEntity storage = new CapacityEntity(CapacityEntity.STORAGE_NAME, 0);
- for (ResourceEntity resource : resourceInstances) {
- for (CapacityEntity capacityEntity : resource.getMinimalCapacities())
- switch (capacityEntity.getName()) {
- case CapacityEntity.PROCESSOR_NAME:
- processors.addQuantity(capacityEntity.getQuantity());
+ Capacity memory = new Capacity(Capacity.MEMORY_NAME, 0);
+ Capacity processors = new Capacity(Capacity.PROCESSOR_NAME, 0);
+ Capacity slots = new Capacity(Capacity.SLOTS_NAME, 0);
+ Capacity storage = new Capacity(Capacity.STORAGE_NAME, 0);
+ for (Resource resource : resourceInstances) {
+ for (Capacity capacity : resource.getMinimalCapacities())
+ switch (capacity.getName()) {
+ case Capacity.PROCESSOR_NAME:
+ processors.addQuantity(capacity.getQuantity());
break;
- case CapacityEntity.MEMORY_NAME:
- memory.addQuantity(capacityEntity.getQuantity());
+ case Capacity.MEMORY_NAME:
+ memory.addQuantity(capacity.getQuantity());
break;
- case CapacityEntity.STORAGE_NAME:
- storage.addQuantity(capacityEntity.getQuantity());
+ case Capacity.STORAGE_NAME:
+ storage.addQuantity(capacity.getQuantity());
break;
- case CapacityEntity.SLOTS_NAME:
- slots.addQuantity(capacityEntity.getQuantity());
+ case Capacity.SLOTS_NAME:
+ slots.addQuantity(capacity.getQuantity());
break;
default:
- log.warn("Capacity {} not found", capacityEntity.getName());
+ log.warn("Capacity {} not found", capacity.getName());
break;
}
}
@@ -98,8 +98,8 @@ public int hashCode() {
public boolean equals(Object obj) {
if ((obj == null) || (!obj.getClass().equals(this.getClass()))) return false;
- TJobEntity objectToCompare = ((TJobEntity) obj);
- for (TestCaseEntity tc : objectToCompare.getListTestCases()) {
+ TJob objectToCompare = ((TJob) obj);
+ for (TestCase tc : objectToCompare.getListTestCases()) {
if (!this.getListTestCases().contains(tc)) {return false;}
}
return this.getListResourceClasses().equals(objectToCompare.getListResourceClasses()) &&
@@ -108,9 +108,9 @@ public boolean equals(Object obj) {
@Override
public String toString() {
- List testCasesNames = listTestCases.stream().map(TestCaseEntity::getName).toList();
+ List testCasesNames = listTestCases.stream().map(TestCase::getName).toList();
List resourceNames =
- listResourceEntities.stream().map(ResourceEntity::getResourceID).toList();
+ listResourceEntities.stream().map(Resource::getResourceID).toList();
return "TJobClass [\n" + "listTc:{\n" + testCasesNames + "}, listRes " + resourceNames + ", intraSchedule '" +
intraTJobSchedule + '\'' + ", con " + tJobConcurrency + ']';
}
@@ -118,22 +118,22 @@ public String toString() {
public static Set getListTJobLifecyclesNames() {return LIST_TJOB_LIFECYCLE;}
public static List getListTJobLifecyclesWithDesiredOrder() {
LinkedList desiredDataOrder = new LinkedList<>();
- desiredDataOrder.add(TJobEntity.LIFECYCLE_SETUP_NAME);
- desiredDataOrder.add(TJobEntity.LIFECYCLE_TESTEXECUTION_NAME);
- desiredDataOrder.add(TJobEntity.LIFECYCLE_TEARDOWN_NAME);
+ desiredDataOrder.add(TJob.LIFECYCLE_SETUP_NAME);
+ desiredDataOrder.add(TJob.LIFECYCLE_TESTEXECUTION_NAME);
+ desiredDataOrder.add(TJob.LIFECYCLE_TEARDOWN_NAME);
return desiredDataOrder;
}
- public Set getTotalCapacities() {return totalCapacities;}
- public List getCapacityNames() {return this.getTotalCapacities().stream().map(CapacityEntity::getName).toList();}
+ public Set getTotalCapacities() {return totalCapacities;}
+ public List getCapacityNames() {return this.getTotalCapacities().stream().map(Capacity::getName).toList();}
public double getElasticityCostResources() {return elasticityCostResources;}
public double getEndExec() {return endExec;}
public double getEndSetUp() {return endSetUp;}
public double getEndTearDown() {return endTearDown;}
public String getIdTJob() {return idTJob.toLowerCase(Locale.ENGLISH);}
public String getIntraTJobSchedule() {return intraTJobSchedule;}
- public List getListResourceClasses() {return listResourceEntities;}
- public List getListTestCases() {
+ public List getListResourceClasses() {return listResourceEntities;}
+ public List getListTestCases() {
return listTestCases;
}
public int getStage() {return stage;}
@@ -166,7 +166,7 @@ public void setAvgTime(double stSetUp, double endSetUp, double stExec, double en
}
}
- public Map.Entry> getCapacitiesGivenTime(double currentTime, double startExecutionTime) {
+ public Map.Entry> getCapacitiesGivenTime(double currentTime, double startExecutionTime) {
double adjustedStartSetUp = this.getStartSetUp() + startExecutionTime;
double adjustedEndSetUp = this.getEndSetUp() + startExecutionTime;
double adjustedStartExec = this.getStartExec() + startExecutionTime;
@@ -187,7 +187,7 @@ public Map.Entry> getCapacitiesGivenTime(double curr
return new AbstractMap.SimpleEntry<>("noexec", Collections.emptySet());
}
- public boolean addTestCase(TestCaseEntity subject) {
+ public boolean addTestCase(TestCase subject) {
if (listTestCases.contains(subject)) return false;
listTestCases.add(subject);
this.updateIntraTestCaseSchedule();
@@ -203,8 +203,8 @@ public boolean addTestCase(TestCaseEntity subject) {
*/
public void updateIntraTestCaseSchedule() {
boolean thereAreAtLeastOneSequential = false;
- for (TestCaseEntity subject : this.listTestCases) {
- for (AccessModeEntity subjectAccessMode : subject.getAccessMode()) {
+ for (TestCase subject : this.listTestCases) {
+ for (AccessMode subjectAccessMode : subject.getAccessMode()) {
if (!subjectAccessMode.getSharing()) thereAreAtLeastOneSequential = true;
// Checks if the given concurrency is lower than stored (if its lower overwrite the value)
if (subjectAccessMode.getConcurrency() < this.tJobConcurrency) this.tJobConcurrency = subjectAccessMode.getConcurrency();
@@ -218,19 +218,19 @@ public void updateIntraTestCaseSchedule() {
* This method add a lis of test cases updating the intra- schedule after it.
* @param testCases List with the test cases to be added
*/
- public void addListTestCases(List testCases) {
+ public void addListTestCases(List testCases) {
this.listTestCases.addAll(testCases);
this.updateIntraTestCaseSchedule();
}
- public void addListResources(List listResources) {
- for (ResourceEntity res : listResources) this.addResource(res);
+ public void addListResources(List listResources) {
+ for (Resource res : listResources) this.addResource(res);
}
/**
* This method add a new resource to the current TJob. First check that the resource is not contained in the
* TJob for after add it and increase the total elasticity cost of the TJob.
*/
- public boolean addResource(ResourceEntity subject) {
+ public boolean addResource(Resource subject) {
if (listResourceEntities.contains(subject)) {
return false;
}
@@ -240,7 +240,7 @@ public boolean addResource(ResourceEntity subject) {
return true;
}
- public void removeTestCase(TestCaseEntity tc) {
+ public void removeTestCase(TestCase tc) {
this.listTestCases.remove(tc);
this.updateIntraTestCaseSchedule();
}
@@ -249,7 +249,7 @@ public void removeTestCase(TestCaseEntity tc) {
*/
public int getMinimalElasticity() {
int minimalElasticity = 50;
- for (ResourceEntity res : this.getListResourceClasses()) {
+ for (Resource res : this.getListResourceClasses()) {
int currentElasticity = res.getElasticityModel().getElasticity();
if (currentElasticity < minimalElasticity) minimalElasticity = currentElasticity;
}
@@ -262,8 +262,8 @@ public int getMinimalElasticity() {
*/
public int getMinimalConcurrency() {
int minimalConcurrency = 50;
- for (TestCaseEntity tc : this.getListTestCases()) {
- for (AccessModeEntity acc : tc.getAccessMode()) {
+ for (TestCase tc : this.getListTestCases()) {
+ for (AccessMode acc : tc.getAccessMode()) {
int concurrency = acc.getConcurrency();
if (concurrency < minimalConcurrency) minimalConcurrency = concurrency;
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCaseEntity.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCase.java
similarity index 74%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCaseEntity.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCase.java
index bcebaf9..190a8ab 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCaseEntity.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/model/TestCase.java
@@ -3,18 +3,18 @@
import java.util.LinkedList;
import java.util.List;
-public class TestCaseEntity {
+public class TestCase {
private final String name;
private final Class> testClass;
- private List accessMode; //List with the access modes (one access mode for each resource)
+ private List accessMode; //List with the access modes (one access mode for each resource)
/**
* RETORCH Test Case has the test name, its class and the access mode that performs over the resource
* @param nameTestCase String with the test case name
* @param classTestCase Class that contains the test case
*/
- public TestCaseEntity(String nameTestCase, Class> classTestCase) {
+ public TestCase(String nameTestCase, Class> classTestCase) {
this.name = nameTestCase;
this.testClass = classTestCase;
this.accessMode = new LinkedList<>();
@@ -23,7 +23,7 @@ public TestCaseEntity(String nameTestCase, Class> classTestCase) {
public Class> getTestClass() {
return testClass;
}
- public void addAccessMode(AccessModeEntity accessMode) {
+ public void addAccessMode(AccessMode accessMode) {
this.accessMode.add(accessMode);
}
@@ -36,7 +36,7 @@ public int hashCode() {
public boolean equals(Object obj) {
if ((obj == null) || (!obj.getClass().equals(this.getClass()))) return false;
- TestCaseEntity objectToCompare = ((TestCaseEntity) obj);
+ TestCase objectToCompare = ((TestCase) obj);
boolean conditionOne = objectToCompare.getAccessMode().equals(this.accessMode);
boolean conditionTwo = objectToCompare.getName().equals(this.name);
return conditionOne && conditionTwo;
@@ -47,14 +47,14 @@ public String toString() {
return "tc{" + "'" + name + '\'' + ", " + accessMode + '}';
}
- public List getAccessMode() {
+ public List getAccessMode() {
return accessMode;
}
public String getName() {
return name;
}
- public void setAccessMode(List accessMode) {
+ public void setAccessMode(List accessMode) {
this.accessMode = accessMode;
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/EmptyInputException.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/EmptyInputException.java
similarity index 91%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/EmptyInputException.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/EmptyInputException.java
index 2652eb1..911df5e 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/EmptyInputException.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/EmptyInputException.java
@@ -1,4 +1,4 @@
-package giis.retorch.orchestration.resourceidentification;
+package giis.retorch.orchestration.testdata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifierUtils.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/ResourceSerializer.java
similarity index 81%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifierUtils.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/ResourceSerializer.java
index 760dbf3..cdd67c6 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifierUtils.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/ResourceSerializer.java
@@ -1,11 +1,11 @@
-package giis.retorch.orchestration.resourceidentification;
+package giis.retorch.orchestration.testdata;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import giis.retorch.orchestration.model.ElasticityModelEntity;
-import giis.retorch.orchestration.model.ResourceEntity;
+import giis.retorch.orchestration.model.ElasticityModel;
+import giis.retorch.orchestration.model.Resource;
import java.io.IOException;
import java.nio.file.Files;
@@ -13,19 +13,19 @@
import java.nio.file.Paths;
import java.util.*;
-public class RetorchClassifierUtils {
+public class ResourceSerializer {
- private final Logger logSerializer = LoggerFactory.getLogger(RetorchClassifierUtils.class);
+ private final Logger logSerializer = LoggerFactory.getLogger(ResourceSerializer.class);
private static final String FOLDER_RESOURCES = "retorchfiles/configurations/";//Base path of the resource files
- final HashMap resourcesToSerialize;//Map with the dictionary of resources to serialize
+ final HashMap resourcesToSerialize;//Map with the dictionary of resources to serialize
final ObjectMapper mapper;
/**
* RETORCH Serializer provides utils to deserialize the configuration files, and create them from scratch with the
* RETORCH entities that they want to serialize in these files.
*/
- public RetorchClassifierUtils() {
+ public ResourceSerializer() {
resourcesToSerialize = new HashMap<>();
mapper = new ObjectMapper();
}
@@ -43,10 +43,10 @@ public RetorchClassifierUtils() {
*/
public void addResourceToSerialize(String resourceId, double elasticityCost, int elasticity, String resourceType,
String hierarchyParent) {
- ElasticityModelEntity elasModel = new ElasticityModelEntity("elasModel" + resourceId);
+ ElasticityModel elasModel = new ElasticityModel("elasModel" + resourceId);
elasModel.setElasticityCost(elasticityCost);
elasModel.setElasticity(elasticity);
- resourcesToSerialize.put(resourceId, new ResourceEntity(resourceId,
+ resourcesToSerialize.put(resourceId, new Resource(resourceId,
new LinkedList<>(Collections.singletonList(hierarchyParent)), new LinkedList<>(), elasModel,
getResourceTypeFromAnnotation(resourceType), new LinkedList<>(), "someimage"));
}
@@ -56,11 +56,11 @@ public void addResourceToSerialize(String resourceId, double elasticityCost, int
*
* @param type String with the type i.e. LOGICAL,COMPUTATIONAL or PHYSICAL
*/
- private ResourceEntity.type getResourceTypeFromAnnotation(String type) {
+ private Resource.type getResourceTypeFromAnnotation(String type) {
try {
- return ResourceEntity.type.valueOf(type);
+ return Resource.type.valueOf(type);
} catch (IllegalArgumentException e) {
- return ResourceEntity.type.LOGICAL; // Default to LOGICAL if type is not recognized
+ return Resource.type.LOGICAL; // Default to LOGICAL if type is not recognized
}
}
@@ -73,10 +73,10 @@ private ResourceEntity.type getResourceTypeFromAnnotation(String type) {
* @param resourceId String with the resource ID
*/
public void addResourceToSerialize(String resourceId, double elasticityCost, int elasticity, String resourceType) {
- ElasticityModelEntity elasModel = new ElasticityModelEntity("elasModel" + resourceId);
+ ElasticityModel elasModel = new ElasticityModel("elasModel" + resourceId);
elasModel.setElasticityCost(elasticityCost);
elasModel.setElasticity(elasticity);
- resourcesToSerialize.put(resourceId, new ResourceEntity(resourceId, new LinkedList<>(), new LinkedList<>(),
+ resourcesToSerialize.put(resourceId, new Resource(resourceId, new LinkedList<>(), new LinkedList<>(),
elasModel, getResourceTypeFromAnnotation(resourceType), new LinkedList<>(), "someImage"));
}
@@ -129,7 +129,7 @@ public T deserialize(String filePath, TypeReference typeRef) throws IOExc
* @throws IOException if an I/O error occurs reading from the file or a malformed or unmappable byte sequence is
* read
*/
- public Map deserializeResources(String name) throws IOException {
+ public Map deserializeResources(String name) throws IOException {
return deserialize(FOLDER_RESOURCES + name + "SystemResources.json", new TypeReference<>() {
});
}
diff --git a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifier.java b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/RetorchClassifier.java
similarity index 82%
rename from retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifier.java
rename to retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/RetorchClassifier.java
index c0cff55..72bb10d 100644
--- a/retorch-orchestration/src/main/java/giis/retorch/orchestration/resourceidentification/RetorchClassifier.java
+++ b/retorch-orchestration/src/main/java/giis/retorch/orchestration/testdata/RetorchClassifier.java
@@ -1,7 +1,8 @@
-package giis.retorch.orchestration.resourceidentification;
+package giis.retorch.orchestration.testdata;
import giis.retorch.annotations.AccessModes;
import giis.retorch.orchestration.model.*;
+import giis.retorch.orchestration.model.System;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -14,7 +15,6 @@
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
-import giis.retorch.annotations.AccessMode;
public class RetorchClassifier {
@@ -22,15 +22,15 @@ public class RetorchClassifier {
private static final String CHORUS_ATTRIBUTES = " is not present";
private static final String NO_EXIST = " doesn't exist";
- private final RetorchClassifierUtils deserializer; //Serializer employed to deserialize the resources info
+ private final ResourceSerializer deserializer; //Serializer employed to deserialize the resources info
- private Map listAllResources;
+ private Map listAllResources;
/**
* Empty constructor used to validate RETORCH in the test case
*/
public RetorchClassifier() {
- deserializer = new RetorchClassifierUtils();
+ deserializer = new ResourceSerializer();
}
/**
* This method gets the file specified as package, in order to do this, instantiates the classLoader
@@ -95,19 +95,19 @@ private static List> findClasses(File directory, String packageName) th
* @param systemName String with the system name (must be the same as specified in the resource attributes JSON
* file
*/
- public SystemEntity getSystemFromPackage(String systemName, String packageName) throws EmptyInputException,
+ public System getSystemFromPackage(String systemName, String packageName) throws EmptyInputException,
IOException, ClassNotFoundException, URISyntaxException {
this.listAllResources= new HashMap<>();
- for (ResourceEntity res:deserializer.deserializeResources(systemName).values()){
+ for (Resource res:deserializer.deserializeResources(systemName).values()){
if (resourceChecker(res)){
this.listAllResources.put(res.getResourceID(),res);
}
}
- SystemEntity systemRetorch = new SystemEntity(systemName);
+ System systemRetorch = new System(systemName);
File directory = getPackageSourceDirectory(packageName);
List> listClassesPackage = findClasses(directory, packageName);
for (Class> currentClass : listClassesPackage) {
- SystemEntity temporalSystem = getSystemFromClass(systemName, currentClass);
+ System temporalSystem = getSystemFromClass(systemName, currentClass);
addUniqueResources(systemRetorch, temporalSystem);
systemRetorch.addListTestCases(temporalSystem.getTestCases());
}
@@ -115,15 +115,15 @@ public SystemEntity getSystemFromPackage(String systemName, String packageName)
return checkSystemClass(systemRetorch);
}
- private void addUniqueResources(SystemEntity systemRetorch, SystemEntity temporalSystem) {
+ private void addUniqueResources(System systemRetorch, System temporalSystem) {
temporalSystem.getResources().stream()
.filter(res -> !systemRetorch.getResources().contains(res))
.forEach(systemRetorch::addResourceClass);
}
- private void sortSystemClass(SystemEntity systemRetorch) {
- systemRetorch.getTestCases().sort(Comparator.comparing(TestCaseEntity::getName));
- systemRetorch.getResources().sort(Comparator.comparing(ResourceEntity::toString));
+ private void sortSystemClass(System systemRetorch) {
+ systemRetorch.getTestCases().sort(Comparator.comparing(TestCase::getName));
+ systemRetorch.getResources().sort(Comparator.comparing(Resource::toString));
}
/**
@@ -135,14 +135,14 @@ private void sortSystemClass(SystemEntity systemRetorch) {
* @param systemName String with the system name
* @param testCaseClass Class with the test cases annotated
*/
- public SystemEntity getSystemFromClass(String systemName, Class> testCaseClass) throws EmptyInputException,
+ public System getSystemFromClass(String systemName, Class> testCaseClass) throws EmptyInputException,
IOException {
this.listAllResources = deserializer.deserializeResources(systemName);
- SystemEntity systemRetorch = new SystemEntity(systemName);
+ System systemRetorch = new System(systemName);
List listMethods = this.getClassMethods(testCaseClass);
systemRetorch.addListOfResources(new ArrayList<>(listAllResources.values()));
for (Method m : listMethods) {
- TestCaseEntity testCase = getTestCasesFromMethod(m, testCaseClass);
+ TestCase testCase = getTestCasesFromMethod(m, testCaseClass);
if (validateTestCase(testCase)) {
systemRetorch.addTestCase(testCase);
}
@@ -159,7 +159,7 @@ public SystemEntity getSystemFromClass(String systemName, Class> testCaseClass
* remains to the annotated resources (3) The access mode is not empty
* @param testCase testCase to be validated
*/
- public boolean validateTestCase(TestCaseEntity testCase) {
+ public boolean validateTestCase(TestCase testCase) {
boolean output = true;
String message;
if (testCase.getAccessMode().isEmpty()) {
@@ -177,11 +177,11 @@ public boolean validateTestCase(TestCaseEntity testCase) {
* @param currentClass Class that belongs the method
* @param currentMethod Test case Method
*/
- public TestCaseEntity getTestCasesFromMethod(Method currentMethod, Class> currentClass) {
+ public TestCase getTestCasesFromMethod(Method currentMethod, Class> currentClass) {
String methodName = currentMethod.getName();
// Directly assign the result of getAccessModesFromMethod to listAccessModesMethod
- List listAccessModesMethod = this.getAccessModesFromMethod(currentMethod);
- TestCaseEntity newTestCase = new TestCaseEntity(methodName, currentClass);
+ List listAccessModesMethod = this.getAccessModesFromMethod(currentMethod);
+ TestCase newTestCase = new TestCase(methodName, currentClass);
newTestCase.setAccessMode(listAccessModesMethod);
return newTestCase;
}
@@ -194,26 +194,26 @@ public TestCaseEntity getTestCasesFromMethod(Method currentMethod, Class> curr
* the accessModes with all the information retrieved from the annotations ( resource,elasticity,sharing...)
* @param testMethod Method to retrieve the annotations.
*/
- public List getAccessModesFromMethod(Method testMethod) {
- List listAccessModes = new ArrayList<>(); // Use ArrayList instead of LinkedList for better
+ public List getAccessModesFromMethod(Method testMethod) {
+ List listAccessModes = new ArrayList<>(); // Use ArrayList instead of LinkedList for better
- List listAccessModesTag = new ArrayList<>(); // random access performance
+ List listAccessModesTag = new ArrayList<>(); // random access performance
- if (testMethod.isAnnotationPresent(AccessMode.class)) { // Check for single annotation presence
- listAccessModesTag.add(testMethod.getAnnotation(AccessMode.class));
+ if (testMethod.isAnnotationPresent(giis.retorch.annotations.AccessMode.class)) { // Check for single annotation presence
+ listAccessModesTag.add(testMethod.getAnnotation(giis.retorch.annotations.AccessMode.class));
}
if (testMethod.isAnnotationPresent(AccessModes.class) ) { // Check for multiple annotations presence
listAccessModesTag.addAll(Arrays.asList(testMethod.getAnnotation(AccessModes.class).value())); // Use
// addAll instead of assignment to avoid overwriting previous values
}
- for (AccessMode accessTag : listAccessModesTag) {
+ for (giis.retorch.annotations.AccessMode accessTag : listAccessModesTag) {
if (this.accessModeTagChecker(accessTag, testMethod.getName())) {
- AccessModeEntity currentAccessMode = new AccessModeEntity();
+ AccessMode currentAccessMode = new AccessMode();
currentAccessMode.setConcurrency(accessTag.concurrency());
- ResourceEntity requiredResource = getRequiredResource(accessTag.resID());
+ Resource requiredResource = getRequiredResource(accessTag.resID());
currentAccessMode.setResource(requiredResource);
currentAccessMode.setSharing(accessTag.sharing());
- currentAccessMode.setAccessMode(new AccessModeTypesEntity(accessTag.accessMode()));
+ currentAccessMode.setType(new AccessModeTypes(accessTag.accessMode()));
listAccessModes.add(currentAccessMode);
}
}
@@ -223,14 +223,14 @@ public List getAccessModesFromMethod(Method testMethod) {
/**
* Support method that checks the resources annotated with the access mode
*/
- public ResourceEntity getRequiredResource(String idResource) {
+ public Resource getRequiredResource(String idResource) {
String message;
if (listAllResources.containsKey(idResource)) {
return listAllResources.get(idResource);
} else {
message=String.format("The resource %s is not tagged", idResource);
log.info(message);
- return new ResourceEntity("Resource Not valid");
+ return new Resource("Resource Not valid");
}
}
@@ -256,7 +256,7 @@ public List getClassMethods(Class> testClass) {
* for finally (3) check if there is only there are one Hierarchy Parent
* @param resource ResourceClass with the resource to check
*/
- private boolean resourceChecker(ResourceEntity resource) {
+ private boolean resourceChecker(Resource resource) {
List listMessages = new LinkedList<>();
if (resource.getHierarchyParent().contains("None")) {
listMessages.add(String.format("The Hierarchy Parent Attribute in resource %s%s",resource.getResourceID(), CHORUS_ATTRIBUTES));
@@ -282,7 +282,7 @@ private boolean resourceChecker(ResourceEntity resource) {
* of the attributes : id,elasticity or cost, (2) If the elasticity or the cost is invalid (negative)
* @param resource Resource with all the attributes
*/
- private boolean elasticityChecker(ResourceEntity resource) {
+ private boolean elasticityChecker(Resource resource) {
boolean isOutElasticityID = resource.getElasticityModel().getElasticityID().equals("None");
boolean isOutElasticity = resource.getElasticityModel().getElasticity() == -1;
boolean isOutElasticityCost = resource.getElasticityModel().getElasticityCost() == -1;
@@ -321,7 +321,7 @@ private boolean elasticityChecker(ResourceEntity resource) {
* @param accessModeTag AccessMode tag
* @param methodName String with the method name
*/
- private boolean accessModeTagChecker(AccessMode accessModeTag, String methodName) {
+ private boolean accessModeTagChecker(giis.retorch.annotations.AccessMode accessModeTag, String methodName) {
List listMessages = new LinkedList<>();
checkConcurrency(accessModeTag, methodName, listMessages);
@@ -339,7 +339,7 @@ private boolean accessModeTagChecker(AccessMode accessModeTag, String methodName
return listMessages.isEmpty();
}
- private void checkConcurrency(AccessMode accessModeTag, String methodName, List listMessages) {
+ private void checkConcurrency(giis.retorch.annotations.AccessMode accessModeTag, String methodName, List listMessages) {
if (accessModeTag.concurrency() == -1) {
listMessages.add(String.format("The Concurrency Attribute in method %s%s", methodName, CHORUS_ATTRIBUTES));
}
@@ -351,8 +351,8 @@ private void checkConcurrency(AccessMode accessModeTag, String methodName, List<
}
}
- private void checkAccessModeType(AccessMode accessModeTag, String methodName, List listMessages) {
- if (!AccessModeTypesEntity.isValidAccessMode(accessModeTag.accessMode())) {
+ private void checkAccessModeType(giis.retorch.annotations.AccessMode accessModeTag, String methodName, List listMessages) {
+ if (!AccessModeTypes.isValidAccessMode(accessModeTag.accessMode())) {
String message = accessModeTag.accessMode().equals("NOASSIGNED")
? String.format("The AccessModeType in method %s is not specified", methodName)
: String.format("The AccessModeType in method %s%s", methodName, NO_EXIST);
@@ -364,19 +364,19 @@ private void checkAccessModeType(AccessMode accessModeTag, String methodName, Li
* Support method that validates the System provided as parameter. It checks that the replaceable resources exists
* @param systemToCheck System to check tag
*/
- private SystemEntity checkSystemClass(SystemEntity systemToCheck) {
- SystemEntity systemEntityOutput = new SystemEntity(systemToCheck.getName());
+ private System checkSystemClass(System systemToCheck) {
+ System systemOutput = new System(systemToCheck.getName());
List idResourcesList = listAllResources.values().stream()
- .map(ResourceEntity::getResourceID)
+ .map(Resource::getResourceID)
.toList();
systemToCheck.getResources().stream()
.filter(res -> idResourcesList.containsAll(res.getReplaceable()))
- .forEach(systemEntityOutput::addResourceClass);
+ .forEach(systemOutput::addResourceClass);
systemToCheck.getResources().stream()
.filter(res -> !idResourcesList.containsAll(res.getReplaceable()))
.forEach(res -> log.error("The Replaceable of resource {}{}", res.getResourceID(), NO_EXIST));
- systemEntityOutput.addListTestCases(systemToCheck.getTestCases());
+ systemOutput.addListTestCases(systemToCheck.getTestCases());
- return systemEntityOutput;
+ return systemOutput;
}
}
\ No newline at end of file
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/components/ClassifierTests.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/ClassifierTests.java
similarity index 72%
rename from retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/components/ClassifierTests.java
rename to retorch-orchestration/src/test/java/giis/retorch/orchestration/ClassifierTests.java
index 07af049..5bcca76 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/components/ClassifierTests.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/ClassifierTests.java
@@ -1,14 +1,14 @@
-package giis.retorch.orchestration.unitary.components;
+package giis.retorch.orchestration;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.classic.spi.LoggingEvent;
import ch.qos.logback.core.Appender;
-import giis.retorch.orchestration.model.SystemEntity;
-import giis.retorch.orchestration.resourceidentification.EmptyInputException;
-import giis.retorch.orchestration.resourceidentification.RetorchClassifier;
-import giis.retorch.orchestration.unitary.testdata.classifier.SyntheticInvalidClassTests;
+import giis.retorch.orchestration.model.System;
+import giis.retorch.orchestration.testdata.EmptyInputException;
+import giis.retorch.orchestration.testdata.RetorchClassifier;
+import giis.retorch.orchestration.testdata.SyntheticInvalidClassTests;
import giis.retorch.orchestration.utils.ClassifierUtils;
-import giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage.insidepackage.SyntheticClassOneTests;
+import giis.retorch.orchestration.testdata.synteticpackage.insidepackage.SyntheticClassOneTests;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
@@ -44,18 +44,18 @@ public void setUp() {
@Test
public void testUnitArchIResValidPackage() throws EmptyInputException, IOException, ClassNotFoundException,
URISyntaxException {
- String packageName = "giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage";
- SystemEntity currentSystem = classifier.getSystemFromPackage(SYSTEM_NAME, packageName);
- SystemEntity expectedSystem = utilsClassifier.generateSystemPackage();
+ String packageName = "giis.retorch.orchestration.testdata.synteticpackage";
+ System currentSystem = classifier.getSystemFromPackage(SYSTEM_NAME, packageName);
+ System expectedSystem = utilsClassifier.generateSystemPackage();
assertEquals(expectedSystem.toString(), currentSystem.toString());
}
@Test
public void testUnitArchIResValidClass() throws EmptyInputException, IOException {
Class> testClass = SyntheticClassOneTests.class;
- SystemEntity systemEntity = classifier.getSystemFromClass(SYSTEM_NAME, testClass);
- SystemEntity expectedSystem = utilsClassifier.generateSystemFromClass();
- assertEquals(expectedSystem.toString(), systemEntity.toString());
+ System system = classifier.getSystemFromClass(SYSTEM_NAME, testClass);
+ System expectedSystem = utilsClassifier.generateSystemFromClass();
+ assertEquals(expectedSystem.toString(), system.toString());
}
@Test(expected = EmptyInputException.class)
@@ -81,7 +81,7 @@ public void testUnitArchIResInvalidClass() throws EmptyInputException, IOExcepti
assertTrue(listMessages.contains("The ResourceID Attribute in method testTwoAttributesLoosingAccessMode is not present")); // Check that the resourceId omitted is detected
// Validation of the attributes
assertTrue(listMessages.contains("The AccessModeType in method validationAccessModeAttributes doesn't exist")); // AccessMode Invalid
- assertTrue(listMessages.contains("The Concurrency in method validationAccessModeAttributes is not valid: non shareable resource with >1 concurrency")); // Concurrency Invalid sharing=true && <2 and sharing
- assertTrue(listMessages.contains("The Concurrency in method validationAccessModeAttributes is not valid: shareable resource with >2 concurrency")); // Concurrency Invalid
+ assertTrue(listMessages.contains("Invalid Concurrency in method validationAccessModeAttributes: non-shareable resource with concurrency > 1")); // Concurrency Invalid sharing=true && <2 and sharing
+ assertTrue(listMessages.contains("Invalid Concurrency in method validationAccessModeAttributes: shareable resource with concurrency < 2")); // Concurrency Invalid
}
}
\ No newline at end of file
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/entities/TJobsEntityTests.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/TJobsEntityTests.java
similarity index 73%
rename from retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/entities/TJobsEntityTests.java
rename to retorch-orchestration/src/test/java/giis/retorch/orchestration/TJobsEntityTests.java
index 2f932a3..80a0179 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/entities/TJobsEntityTests.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/TJobsEntityTests.java
@@ -1,4 +1,4 @@
-package giis.retorch.orchestration.unitary.entities;
+package giis.retorch.orchestration;
import org.junit.Before;
import org.junit.Rule;
@@ -6,10 +6,10 @@
import org.junit.rules.TestName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import giis.retorch.orchestration.model.CapacityEntity;
-import giis.retorch.orchestration.model.ResourceEntity;
-import giis.retorch.orchestration.model.TJobEntity;
-import giis.retorch.orchestration.model.ResourceInstanceEntity;
+import giis.retorch.orchestration.model.Capacity;
+import giis.retorch.orchestration.model.Resource;
+import giis.retorch.orchestration.model.TJob;
+import giis.retorch.orchestration.model.ResourceInstance;
import java.util.LinkedList;
import java.util.Map;
@@ -21,7 +21,7 @@ public class TJobsEntityTests {
private final Logger log = LoggerFactory.getLogger(this.getClass());
- TJobEntity tjob;
+ TJob tjob;
@Rule
public TestName testName = new TestName();
@@ -29,13 +29,13 @@ public class TJobsEntityTests {
@Before
public void setUp() {
log.info("****** Running test: {} ******", testName.getMethodName());
- LinkedList listCapacities = new LinkedList<>();
- listCapacities.add(new CapacityEntity("memory", 4));
- listCapacities.add(new CapacityEntity("processor", 3));
- ResourceInstanceEntity resourceOne = new ResourceInstanceEntity("webserver", listCapacities);
- LinkedList listResources = new LinkedList<>();
+ LinkedList listCapacities = new LinkedList<>();
+ listCapacities.add(new Capacity("memory", 4));
+ listCapacities.add(new Capacity("processor", 3));
+ ResourceInstance resourceOne = new ResourceInstance("webserver", listCapacities);
+ LinkedList listResources = new LinkedList<>();
listResources.add(resourceOne);
- tjob = new TJobEntity("tjoba", 0, listResources);
+ tjob = new TJob("tjoba", 0, listResources);
log.info("****** Set-up for test: {} ended ******", testName.getMethodName());
}
@@ -61,10 +61,10 @@ public void testTJobAvgTime() {
@Test
public void testLifecycleCapacities() {
tjob.setAvgTime(2, 10, 11, 16, 17, 21);
- CapacityEntity capacityOne = new CapacityEntity("memory", 4);
- CapacityEntity capacityTwo = new CapacityEntity("processor", 3);
+ Capacity capacityOne = new Capacity("memory", 4);
+ Capacity capacityTwo = new Capacity("processor", 3);
- Map.Entry> output;
+ Map.Entry> output;
output = tjob.getCapacitiesGivenTime(1, 0);
assertEquals("noexec", output.getKey());
assertTrue(output.getValue().isEmpty());
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/SyntheticInvalidClassTests.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/SyntheticInvalidClassTests.java
similarity index 98%
rename from retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/SyntheticInvalidClassTests.java
rename to retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/SyntheticInvalidClassTests.java
index d2e06f5..ecf0eec 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/SyntheticInvalidClassTests.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/SyntheticInvalidClassTests.java
@@ -1,4 +1,4 @@
-package giis.retorch.orchestration.unitary.testdata.classifier;
+package giis.retorch.orchestration.testdata;
import giis.retorch.annotations.AccessMode;
import org.junit.Assert;
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/SyntheticClassTwoTests.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/SyntheticClassTwoTests.java
similarity index 90%
rename from retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/SyntheticClassTwoTests.java
rename to retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/SyntheticClassTwoTests.java
index f92ca42..942dd60 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/SyntheticClassTwoTests.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/SyntheticClassTwoTests.java
@@ -1,4 +1,4 @@
-package giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage;
+package giis.retorch.orchestration.testdata.synteticpackage;
import giis.retorch.annotations.AccessMode;
import org.junit.Assert;
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/insidepackage/SyntheticClassOneTests.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/insidepackage/SyntheticClassOneTests.java
similarity index 95%
rename from retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/insidepackage/SyntheticClassOneTests.java
rename to retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/insidepackage/SyntheticClassOneTests.java
index f890df7..8d65940 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/unitary/testdata/classifier/synteticpackage/insidepackage/SyntheticClassOneTests.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/testdata/synteticpackage/insidepackage/SyntheticClassOneTests.java
@@ -1,4 +1,4 @@
-package giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage.insidepackage;
+package giis.retorch.orchestration.testdata.synteticpackage.insidepackage;
import giis.retorch.annotations.AccessMode;
import org.junit.Assert;
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/ClassifierUtils.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/ClassifierUtils.java
index 6eaccfd..3f34597 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/ClassifierUtils.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/ClassifierUtils.java
@@ -1,8 +1,9 @@
package giis.retorch.orchestration.utils;
import giis.retorch.orchestration.model.*;
-import giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage.SyntheticClassTwoTests;
-import giis.retorch.orchestration.unitary.testdata.classifier.synteticpackage.insidepackage.SyntheticClassOneTests;
+import giis.retorch.orchestration.model.System;
+import giis.retorch.orchestration.testdata.synteticpackage.SyntheticClassTwoTests;
+import giis.retorch.orchestration.testdata.synteticpackage.insidepackage.SyntheticClassOneTests;
import java.util.Comparator;
import java.util.LinkedList;
@@ -10,36 +11,36 @@
public class ClassifierUtils extends GenericUtils {
- public List getAllTestCases() {
- LinkedList listTestCases = getFirstClassTestCases();
- TestCaseEntity tCMFour = new TestCaseEntity("testFourH", SyntheticClassTwoTests.class);
+ public List getAllTestCases() {
+ LinkedList listTestCases = getFirstClassTestCases();
+ TestCase tCMFour = new TestCase("testFourH", SyntheticClassTwoTests.class);
tCMFour.addAccessMode(getOtherAccessModeHeavyInelasticResource());
listTestCases.add(tCMFour);
- TestCaseEntity tCMFive = new TestCaseEntity("testFiveH", SyntheticClassTwoTests.class);
+ TestCase tCMFive = new TestCase("testFiveH", SyntheticClassTwoTests.class);
tCMFive.addAccessMode(getOtherAccessModeHeavyInelasticResource());
listTestCases.add(tCMFive);
- TestCaseEntity tCMEight = new TestCaseEntity("testEightH", SyntheticClassTwoTests.class);
+ TestCase tCMEight = new TestCase("testEightH", SyntheticClassTwoTests.class);
tCMEight.addAccessMode(this.getJSONSavedInelasticAccessMode());
listTestCases.add(tCMEight);
return listTestCases;
}
- public SystemEntity generateSystemPackage() {
+ public System generateSystemPackage() {
generateSystemResources();
- SystemEntity expectedSystem = new SystemEntity("ClassifierUnitTests");
+ System expectedSystem = new System("ClassifierUnitTests");
expectedSystem.addResourceClass(this.getHeavyInelasticResource());
expectedSystem.addResourceClass(this.getLightElasticResource());
expectedSystem.addResourceClass(this.getMockElasticResource());
expectedSystem.addResourceClass(this.getJSONSavedInelasticResource());
expectedSystem.addResourceClass(this.getJSONSavedElasticResource());
- expectedSystem.getResources().sort(Comparator.comparing(ResourceEntity::toString));
- expectedSystem.addListTestCases(getAllTestCases().stream().sorted(Comparator.comparing(TestCaseEntity::getName)).toList());
+ expectedSystem.getResources().sort(Comparator.comparing(Resource::toString));
+ expectedSystem.addListTestCases(getAllTestCases().stream().sorted(Comparator.comparing(TestCase::getName)).toList());
return expectedSystem;
}
- public SystemEntity generateSystemFromClass() {
+ public System generateSystemFromClass() {
generateSystemResources();
- SystemEntity expectedSystem = new SystemEntity("ClassifierUnitTests");
+ System expectedSystem = new System("ClassifierUnitTests");
expectedSystem.addResourceClass(this.getHeavyInelasticResource());
expectedSystem.addResourceClass(this.getLightElasticResource());
expectedSystem.addResourceClass(this.getMockElasticResource());
@@ -47,46 +48,46 @@ public SystemEntity generateSystemFromClass() {
return expectedSystem;
}
- private LinkedList getFirstClassTestCases() {
- LinkedList listTestCases = new LinkedList<>();
- TestCaseEntity tCHOne = new TestCaseEntity("testOneH", SyntheticClassOneTests.class);
+ private LinkedList getFirstClassTestCases() {
+ LinkedList listTestCases = new LinkedList<>();
+ TestCase tCHOne = new TestCase("testOneH", SyntheticClassOneTests.class);
tCHOne.addAccessMode(this.getAccessModeHeavyInElasticResource());
tCHOne.addAccessMode(this.getAccessModeLightElasticResource());
listTestCases.add(tCHOne);
- TestCaseEntity tCHTwo = new TestCaseEntity("testTwoH", SyntheticClassOneTests.class);
+ TestCase tCHTwo = new TestCase("testTwoH", SyntheticClassOneTests.class);
tCHTwo.addAccessMode(this.getAccessModeHeavyInElasticResource());
tCHTwo.addAccessMode(this.getAccessModeLightElasticResource());
listTestCases.add(tCHTwo);
- TestCaseEntity tCHThree = new TestCaseEntity("testThreeH", SyntheticClassOneTests.class);
+ TestCase tCHThree = new TestCase("testThreeH", SyntheticClassOneTests.class);
tCHThree.addAccessMode(getAccessModeHeavyInElasticResource());
tCHThree.addAccessMode(this.getMockElasticAccessMode());
listTestCases.add(tCHThree);
- TestCaseEntity tCHSix = new TestCaseEntity("testSixH", SyntheticClassOneTests.class);
+ TestCase tCHSix = new TestCase("testSixH", SyntheticClassOneTests.class);
tCHSix.addAccessMode(this.getJSONSavedInelasticAccessMode());
tCHSix.addAccessMode(this.getJSONSavedElasticAccessMode());
listTestCases.add(tCHSix);
- TestCaseEntity tCHSeven = new TestCaseEntity("testSevenH", SyntheticClassOneTests.class);
+ TestCase tCHSeven = new TestCase("testSevenH", SyntheticClassOneTests.class);
tCHSeven.addAccessMode(this.getJSONSavedInelasticAccessMode());
tCHSeven.addAccessMode(this.getJSONSavedElasticAccessMode());
listTestCases.add(tCHSeven);
return listTestCases;
}
- private AccessModeEntity getJSONSavedInelasticAccessMode() {
- AccessModeEntity accessModeEntity = new AccessModeEntity(this.getAccessModeHeavyInElasticResource());
- accessModeEntity.setResource(this.getJSONSavedInelasticResource());
- return accessModeEntity;
+ private AccessMode getJSONSavedInelasticAccessMode() {
+ AccessMode accessMode = new AccessMode(this.getAccessModeHeavyInElasticResource());
+ accessMode.setResource(this.getJSONSavedInelasticResource());
+ return accessMode;
}
- private AccessModeEntity getJSONSavedElasticAccessMode() {
- AccessModeEntity accessModeEntity = new AccessModeEntity(this.getAccessModeLightElasticResource());
- accessModeEntity.setResource(this.getJSONSavedElasticResource());
- return accessModeEntity;
+ private AccessMode getJSONSavedElasticAccessMode() {
+ AccessMode accessMode = new AccessMode(this.getAccessModeLightElasticResource());
+ accessMode.setResource(this.getJSONSavedElasticResource());
+ return accessMode;
}
- private ResourceEntity getJSONSavedInelasticResource() {
- ResourceEntity outputResource = new ResourceEntity(this.getHeavyInelasticResource());
- ElasticityModelEntity modelJSON = outputResource.getElasticityModel();
+ private Resource getJSONSavedInelasticResource() {
+ Resource outputResource = new Resource(this.getHeavyInelasticResource());
+ ElasticityModel modelJSON = outputResource.getElasticityModel();
modelJSON.setElasticityID("elasModelHeavyInElasRest");
outputResource.setElasticityModel(modelJSON);
outputResource.setResourceID("heavyInElasRest");
@@ -96,9 +97,9 @@ private ResourceEntity getJSONSavedInelasticResource() {
return outputResource;
}
- private ResourceEntity getJSONSavedElasticResource() {
- ResourceEntity outputResource = new ResourceEntity(this.getLightElasticResource());
- ElasticityModelEntity modelJSON = outputResource.getElasticityModel();
+ private Resource getJSONSavedElasticResource() {
+ Resource outputResource = new Resource(this.getLightElasticResource());
+ ElasticityModel modelJSON = outputResource.getElasticityModel();
modelJSON.setElasticityID("elasModelLightElasticResource");
outputResource.setElasticityModel(modelJSON);
outputResource.setResourceID("lightElasticResource");
diff --git a/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/GenericUtils.java b/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/GenericUtils.java
index 8f08d21..8bf8590 100644
--- a/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/GenericUtils.java
+++ b/retorch-orchestration/src/test/java/giis/retorch/orchestration/utils/GenericUtils.java
@@ -14,74 +14,74 @@ public class GenericUtils {
protected static final String LIGHT_ELASTIC_ID = "lightElasticResource";
protected static final String HEAVY_INELASTIC_ID = "heavyInElasRest";
- public ElasticityModelEntity getElasticityModelMockResource() {
- ElasticityModelEntity expectedElasticityModelMock = new ElasticityModelEntity("elasticityIDMockElastic");
+ public ElasticityModel getElasticityModelMockResource() {
+ ElasticityModel expectedElasticityModelMock = new ElasticityModel("elasticityIDMockElastic");
expectedElasticityModelMock.setElasticity(50);
expectedElasticityModelMock.setElasticityCost(0);
return expectedElasticityModelMock;
}
- public AccessModeEntity getAccessModeHeavyInElasticResource() {
- AccessModeEntity expectedAccessModeHeavy = new AccessModeEntity();
+ public AccessMode getAccessModeHeavyInElasticResource() {
+ AccessMode expectedAccessModeHeavy = new AccessMode();
expectedAccessModeHeavy.setSharing(false);
expectedAccessModeHeavy.setConcurrency(1);
expectedAccessModeHeavy.setResource(this.getHeavyInelasticResource());
- expectedAccessModeHeavy.setAccessMode(new AccessModeTypesEntity(READWRITE));
+ expectedAccessModeHeavy.setType(new AccessModeTypes(READWRITE));
return expectedAccessModeHeavy;
}
- public AccessModeEntity getOtherAccessModeHeavyInelasticResource() {
- AccessModeEntity expectedAccessModeHeavy = new AccessModeEntity(this.getAccessModeHeavyInElasticResource());
+ public AccessMode getOtherAccessModeHeavyInelasticResource() {
+ AccessMode expectedAccessModeHeavy = new AccessMode(this.getAccessModeHeavyInElasticResource());
expectedAccessModeHeavy.setSharing(false);
expectedAccessModeHeavy.setConcurrency(1);
expectedAccessModeHeavy.setResource(this.getHeavyInelasticResource());
- expectedAccessModeHeavy.setAccessMode(new AccessModeTypesEntity(READWRITE));
+ expectedAccessModeHeavy.setType(new AccessModeTypes(READWRITE));
return expectedAccessModeHeavy;
}
- public AccessModeEntity getAccessModeLightElasticResource() {
- AccessModeEntity expectedAccessModeHeavy = new AccessModeEntity();
+ public AccessMode getAccessModeLightElasticResource() {
+ AccessMode expectedAccessModeHeavy = new AccessMode();
expectedAccessModeHeavy.setSharing(true);
expectedAccessModeHeavy.setConcurrency(4);
expectedAccessModeHeavy.setResource(this.getLightElasticResource());
- expectedAccessModeHeavy.setAccessMode(new AccessModeTypesEntity(READWRITE));
+ expectedAccessModeHeavy.setType(new AccessModeTypes(READWRITE));
return expectedAccessModeHeavy;
}
- public ResourceEntity getLightElasticResource() {
- ResourceEntity lightElasticResource = new ResourceEntity(LIGHT_ELASTIC_ID);
+ public Resource getLightElasticResource() {
+ Resource lightElasticResource = new Resource(LIGHT_ELASTIC_ID);
lightElasticResource.setElasticityModel(getElasticityModelLightElasticResource());
- List requiredCapacities = new LinkedList<>();
- requiredCapacities.add(new CapacityEntity("memory", 1));
- requiredCapacities.add(new CapacityEntity("processor", 0.5));
+ List requiredCapacities = new LinkedList<>();
+ requiredCapacities.add(new Capacity("memory", 1));
+ requiredCapacities.add(new Capacity("processor", 0.5));
lightElasticResource.setMinimalCapacities(requiredCapacities);
return lightElasticResource;
}
- public ElasticityModelEntity getElasticityModelLightElasticResource() {
- ElasticityModelEntity expectedElasticityModelMySQL = new ElasticityModelEntity("elasModelLightElasticResource");
+ public ElasticityModel getElasticityModelLightElasticResource() {
+ ElasticityModel expectedElasticityModelMySQL = new ElasticityModel("elasModelLightElasticResource");
expectedElasticityModelMySQL.setElasticity(35);
expectedElasticityModelMySQL.setElasticityCost(15.0);
return expectedElasticityModelMySQL;
}
- public AccessModeEntity getMockElasticAccessMode() {
- AccessModeEntity expectedAccessModeHeavy = new AccessModeEntity();
+ public AccessMode getMockElasticAccessMode() {
+ AccessMode expectedAccessModeHeavy = new AccessMode();
expectedAccessModeHeavy.setSharing(true);
expectedAccessModeHeavy.setConcurrency(4);
expectedAccessModeHeavy.setResource(this.getMockElasticResource());
- expectedAccessModeHeavy.setAccessMode(new AccessModeTypesEntity(READONLY));
+ expectedAccessModeHeavy.setType(new AccessModeTypes(READONLY));
return expectedAccessModeHeavy;
}
- public ResourceEntity getMockElasticResource() {
- ResourceEntity mockElasticResource = new ResourceEntity(LIGHT_ELASTIC_ID);
+ public Resource getMockElasticResource() {
+ Resource mockElasticResource = new Resource(LIGHT_ELASTIC_ID);
mockElasticResource.setResourceID("mockElasticResource");
- ElasticityModelEntity modelMock = new ElasticityModelEntity("elasModelmockElasticResource", 50, 0.0);
+ ElasticityModel modelMock = new ElasticityModel("elasModelmockElasticResource", 50, 0.0);
mockElasticResource.setElasticityModel(modelMock);
- List requiredCapacities = new LinkedList<>();
- requiredCapacities.add(new CapacityEntity("memory", 0.5));
- requiredCapacities.add(new CapacityEntity("processor", 2.0));
+ List requiredCapacities = new LinkedList<>();
+ requiredCapacities.add(new Capacity("memory", 0.5));
+ requiredCapacities.add(new Capacity("processor", 2.0));
mockElasticResource.setMinimalCapacities(requiredCapacities);
mockElasticResource.addReplaceableResource(LIGHT_ELASTIC_ID);
mockElasticResource.addReplaceableResource(HEAVY_INELASTIC_ID);
@@ -94,20 +94,20 @@ public void generateSystemResources() {
getLightElasticResource();
}
- public ResourceEntity getHeavyInelasticResource() {
- ResourceEntity heavyInelasticResource = new ResourceEntity(HEAVY_INELASTIC_ID);
+ public Resource getHeavyInelasticResource() {
+ Resource heavyInelasticResource = new Resource(HEAVY_INELASTIC_ID);
heavyInelasticResource.addHierarchyParent("parentAllInelastic");
heavyInelasticResource.setElasticityModel(getElasticityModelHeavyInelasticResource());
- heavyInelasticResource.setResourceType(ResourceEntity.type.LOGICAL);
- List requiredCapacities = new LinkedList<>();
- requiredCapacities.add(new CapacityEntity("memory", 4.0));
- requiredCapacities.add(new CapacityEntity("processor", 0.6));
+ heavyInelasticResource.setResourceType(Resource.type.LOGICAL);
+ List requiredCapacities = new LinkedList<>();
+ requiredCapacities.add(new Capacity("memory", 4.0));
+ requiredCapacities.add(new Capacity("processor", 0.6));
heavyInelasticResource.setMinimalCapacities(requiredCapacities);
return heavyInelasticResource;
}
- public ElasticityModelEntity getElasticityModelHeavyInelasticResource() {
- ElasticityModelEntity expectedElasticityModelHeavy = new ElasticityModelEntity("elasModelHeavyInElasRest");
+ public ElasticityModel getElasticityModelHeavyInelasticResource() {
+ ElasticityModel expectedElasticityModelHeavy = new ElasticityModel("elasModelHeavyInElasRest");
expectedElasticityModelHeavy.setElasticity(1);
expectedElasticityModelHeavy.setElasticityCost(50.0);
return expectedElasticityModelHeavy;
diff --git a/retorch-orchestration/src/test/resources/log4j2.xml b/retorch-orchestration/src/test/resources/log4j2.xml
deleted file mode 100644
index d8f4072..0000000
--- a/retorch-orchestration/src/test/resources/log4j2.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/retorch-orchestration/src/test/resources/logback.xml b/retorch-orchestration/src/test/resources/logback.xml
new file mode 100644
index 0000000..544b7d6
--- /dev/null
+++ b/retorch-orchestration/src/test/resources/logback.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+ %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%throwable
+
+
+
+
+
+ target/log-test.log
+ true
+
+ %d [%thread] %-5level %logger{36} - %msg%n%throwable
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+