Skip to content

Commit

Permalink
First commit: migrating the resource identifier with the entities + t…
Browse files Browse the repository at this point in the history
…est cases
  • Loading branch information
augustocristian committed Nov 13, 2024
1 parent aaeedb7 commit bf64b1f
Show file tree
Hide file tree
Showing 30 changed files with 2,387 additions and 2 deletions.
23 changes: 22 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,27 @@

<modules>
<module>retorch-annotations</module>
<module>retorch-orchestration</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.24.1</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -71,7 +88,7 @@
<developers>
<developer>
<name>Cristian Augusto</name>
<url>http://giis.uniovi.es</url>
<url>http://www.augustocristian.es</url>
</developer>
<developer>
<name>Claudio de la Riva</name>
Expand All @@ -81,6 +98,10 @@
<name>Javier Tuya</name>
<url>http://giis.uniovi.es</url>
</developer>
<developer>
<name>Jesús Morán</name>
<url>http://giis.uniovi.es</url>
</developer>
</developers>
<licenses>
<license>
Expand Down
40 changes: 40 additions & 0 deletions retorch-orchestration/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions retorch-orchestration/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>retorch-orchestration</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
8 changes: 8 additions & 0 deletions retorch-orchestration/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 4 additions & 0 deletions retorch-orchestration/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
88 changes: 88 additions & 0 deletions retorch-orchestration/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.github.giis-uniovi</groupId>
<artifactId>retorch</artifactId>
<version>1.1.1-SNAPSHOT</version>
</parent>
<artifactId>retorch-orchestration</artifactId>
<packaging>jar</packaging>
<name>retorch-orchestration</name>
<description>Multimodule maven project template, module without dependencies</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<organization>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
</organization>
<properties>
<!--Separate all dependencies by a blank line to avoid problems creating combined dependencies in dependabot.-->
<jacksonjson.version>2.18.1</jacksonjson.version>

<mockito.version>5.14.2</mockito.version>

<logback-classic.version>1.5.12</logback-classic.version>

</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency><!-- This package allows to serialize the resources -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jacksonjson.version}</version>
</dependency>
<dependency><!-- Mockito is used to get the logs and check that the errors appear https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.giis-uniovi</groupId>
<artifactId>retorch-annotations</artifactId>
<version>1.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>16</source>
<target>16</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"mockElasticResource": {
"hierarchyParent": [],
"replaceable": ["lightElasticResource","heavyInElasRest"],
"elasticityModel": {
"elasticityID": "elasModelmockElasticResource",
"elasticity": 50,
"elasticityCost": 0.0
},
"resourceType": "LOGICAL",
"resourceID": "mockElasticResource",
"minimalCapacities": [
{
"name": "memory",
"quantity": 0.5
},
{
"name": "processor",
"quantity": 2
}
],
"dockerImage": "someplaceholder1[IMG:]docker.someImage"
},
"heavyInElasRest": {
"hierarchyParent": [
"parentAllInelastic"
],
"replaceable": [],
"elasticityModel": {
"elasticityID": "elasModelHeavyInElasRest",
"elasticity": 1,
"elasticityCost": 50.0
},
"resourceType": "LOGICAL",
"resourceID": "heavyInElasRest",
"minimalCapacities": [
{
"name": "memory",
"quantity": 4
},
{
"name": "processor",
"quantity": 0.6
}
],
"dockerImage": "someplaceholder2[IMG:]docker.someImage"
},
"lightElasticResource": {
"hierarchyParent": [],
"replaceable": [],
"elasticityModel": {
"elasticityID": "elasModelLightElasticResource",
"elasticity": 35,
"elasticityCost": 15.0
},
"resourceType": "LOGICAL",
"resourceID": "lightElasticResource",
"minimalCapacities": [
{
"name": "memory",
"quantity": 1
},
{
"name": "processor",
"quantity": 0.5
}
],
"dockerImage": "someplaceholder3[IMG:]docker.someImage"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
agentCIName=any
sut-wait-html=<title>FullTeaching</title>
sut-location=$WORKSPACE
docker-frontend-name=https://full-teaching-
docker-frontend-port=5000
external-binded-port=
external-frontend-url=
testsBasePath=somepath/somedir/
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package giis.retorch.orchestration.model;

/**
* RETORCH access mode that represents how a test case uses a resource
*/
public class AccessModeEntity {

private AccessModeTypesEntity accessMode;
private boolean sharing = false;
private int concurrency = 1;
private ResourceEntity resource;

public AccessModeEntity() {
}
/**
* RETORCH access mode copy constructor
*/
public AccessModeEntity(AccessModeEntity accessMode) {
this.accessMode = accessMode.getAccessMode();
this.concurrency = accessMode.getConcurrency();
this.resource = accessMode.getResource();
this.sharing = accessMode.getSharing();
}

public AccessModeTypesEntity getAccessMode() {
return accessMode;
}
public int getConcurrency() {
return concurrency;
}
public ResourceEntity getResource() {
return resource;
}
public boolean getSharing() {
return sharing;
}
public void setSharing(boolean sharing) {
this.sharing = sharing;
}
public void setResource(ResourceEntity resource) {
this.resource = resource;
}
public void setConcurrency(int concurrency) {
this.concurrency = concurrency;
}
public void setAccessMode(AccessModeTypesEntity accessMode) {
this.accessMode = accessMode;
}

/**
* Access mode constructor
* @param accessMode {@link AccessModeTypesEntity} 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;
this.sharing = sharing;
this.concurrency = concurrency;
this.resource = resource;
}

@Override
public int hashCode() {
return super.hashCode();
}

@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (!obj.getClass().equals(this.getClass())) return false;
AccessModeEntity objToCompare = ((AccessModeEntity) obj);

return objToCompare.getSharing() == this.sharing && objToCompare.getConcurrency() == this.concurrency
&& objToCompare.getAccessMode().equals(this.accessMode) && objToCompare.getResource().equals(this.resource);
}

@Override
public String toString() {
return "a.m.{" + accessMode + ", " + sharing + ", " + concurrency + ",'" + resource + '\'' + '}';
}
}
Loading

0 comments on commit bf64b1f

Please sign in to comment.