ATTENTION: we are currently upgrading gitlabs storage backend for repositories. This may cause unavailability and in unlikely cases also data loss. Therefore, we recommend to keep local copies of all repos. Issues, Milestones, and other features of gitlab are not affected.

Commit 2d033478 authored by Daniel Seybold's avatar Daniel Seybold

added intial version of the programming test

parents
<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 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.uulm.omi.ds.coding</groupId>
<artifactId>coding-assesment</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>coding-assesment</name>
<url>http://maven.apache.org</url>
<properties>
<!-- Source encoding -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Cloudiator dependencies -->
<dependency>
<groupId>io.github.cloudiator</groupId>
<artifactId>colosseum-client</artifactId>
<version>0.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>de.uulm.omi.ds.coding.App</mainClass>
<arguments>
<!-- <argument>foo</argument>
<argument>bar</argument> -->
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<finalName>coding-assesment</finalName>
<appendAssemblyId>true</appendAssemblyId>
<archive>
<manifest>
<mainClass>de.uulm.omi.ds.coding.App
</mainClass>
</manifest>
</archive>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<inherited>true</inherited>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<inherited>true</inherited>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
package de.uulm.omi.ds.coding;
import de.uniulm.omi.cloudiator.colosseum.client.Client;
import de.uniulm.omi.cloudiator.colosseum.client.entities.HardwareOffer;
import de.uniulm.omi.cloudiator.colosseum.client.entities.Image;
import de.uniulm.omi.cloudiator.colosseum.client.entities.Location;
import de.uulm.omi.ds.coding.utils.ColosseumClientHelper;
import java.util.List;
public class App {
public static void main( String[] args ){
Client client = ColosseumClientHelper.getColosseumClient();
/**
* retrieving a list of Image objects from the remote service Colosseum
*/
List<Image> images = client.controller(Image.class).getList();
/**
* retrieving a list of location objects from the remote service Colosseum
*/
List<Location> locations = client.controller(Location.class).getList();
/**
* retrieving a list of hardwareOffers objects from the remote service Colosseum
*/
List<HardwareOffer> hardwareOffers = client.controller(HardwareOffer.class).getList();
//TODO: Task 1
// define a new class VirtualMachine that contains the following attributes:
// String imageName
// Long imageId
// String locationName
// Long locationId
// String hardwareHumanReadable
// Long hardwareOfferId
//TODO: Task 2
//create a list of VirtualMachines that fulfil the following constraints
// image name contains assignable
// location is assignable
// number of cores > 4
//TODO: Task 3
// print the created list of VirtualMachines to stdout
}
}
package de.uulm.omi.ds.coding.utils;
import de.uniulm.omi.cloudiator.colosseum.client.Client;
import de.uniulm.omi.cloudiator.colosseum.client.ClientBuilder;
/**
* Created by Daniel Seybold on 21.02.2019.
*/
public class ColosseumClientHelper {
public static Client getColosseumClient(){
String colosseumUri = "http://134.60.152.90:9000/api";
ClientBuilder clientBuilder = ClientBuilder.getNew().url(colosseumUri)
.credentials("john.doe@example.com", "admin", "admin");
Client colosseumClient = clientBuilder.build();
return colosseumClient;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment