Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class CloudConverter implements TwoWayConverter<Cloud, IaasEntities.Cloud
public Cloud applyBack(IaasEntities.Cloud cloud) {
final boolean checkByon = ByonCloudUtil.isByon(cloud.getId());

if(checkByon) {
if (checkByon) {
throw new IllegalStateException("Cannot process Cloud contents corresponding to byon");
}

Expand Down Expand Up @@ -65,8 +65,8 @@ public IaasEntities.Cloud apply(Cloud cloud) {

if (!checkByon) {
builder.setEndpoint(cloud.getEndpoint())
.setCloudType(TYPE_CONVERTER.apply(cloud.getType()))
.setState(CLOUD_STATE_CONVERTER.apply(cloud.getState()));
.setCloudType(TYPE_CONVERTER.apply(cloud.getType()))
.setState(CLOUD_STATE_CONVERTER.apply(cloud.getState()));
}

if (!Strings.isNullOrEmpty(cloud.getDiagnostic())) {
Expand Down Expand Up @@ -180,6 +180,8 @@ public CloudType applyBack(IaasEntities.CloudType cloudType) {
return CloudType.PRIVATE;
case PUBLIC_CLOUD:
return CloudType.PUBLIC;
case SIMULATION_CLOUD:
return CloudType.SIMULATION;
case UNRECOGNIZED:
default:
throw new AssertionError(
Expand All @@ -194,6 +196,8 @@ public IaasEntities.CloudType apply(CloudType cloudType) {
return IaasEntities.CloudType.PUBLIC_CLOUD;
case PRIVATE:
return IaasEntities.CloudType.PRIVATE_CLOUD;
case SIMULATION:
return IaasEntities.CloudType.SIMULATION_CLOUD;
default:
throw new AssertionError(String.format("CloudType %s is not known.", cloudType));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import cloudiator.NodeType;
import cloudiator.Runtime;
import de.uniulm.omi.cloudiator.util.OneWayConverter;
import javax.annotation.Nullable;
import org.cloudiator.matchmaking.domain.NodeCandidate;
import org.cloudiator.messages.entities.MatchmakingEntities;

import javax.annotation.Nullable;

public class NodeCandidateConverter implements
OneWayConverter<NodeCandidate, MatchmakingEntities.NodeCandidate> {

Expand All @@ -27,14 +26,16 @@ private NodeCandidateConverter() {
public MatchmakingEntities.NodeCandidate apply(@Nullable NodeCandidate nodeCandidate) {
switch (nodeCandidate.getType()) {
case IAAS:
case SIMULATION:
return applyIaas(nodeCandidate);
case FAAS:
return applyFaas(nodeCandidate);
case BYON:
return applyByon(nodeCandidate);
case PAAS:
default:
throw new IllegalStateException("Unsupported node candidate type: " + nodeCandidate.getType());
throw new IllegalStateException(
"Unsupported node candidate type: " + nodeCandidate.getType());
}
}

Expand Down Expand Up @@ -84,6 +85,8 @@ private MatchmakingEntities.NodeCandidateType convertType(NodeType type) {
return MatchmakingEntities.NodeCandidateType.NC_PAAS;
case BYON:
return MatchmakingEntities.NodeCandidateType.NC_BYON;
case SIMULATION:
return MatchmakingEntities.NodeCandidateType.NC_SIMULATION;
default:
throw new IllegalStateException();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class HashingNodeCandidateIdGenerator implements NodeCandidateIdGenerator
public String generateId(NodeCandidate nodeCandidate) {
switch (nodeCandidate.getType()) {
case IAAS:
case SIMULATION:
return HASH_FUNCTION.hashObject(nodeCandidate, IAAS_NODE_CANDIDATE_FUNNEL).toString();
case FAAS:
return HASH_FUNCTION.hashObject(nodeCandidate, FAAS_NODE_CANDIDATE_FUNNEL).toString();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.cloudiator.matchmaking.domain;

import cloudiator.Cloud;
import cloudiator.CloudType;
import cloudiator.CloudiatorFactory;
import cloudiator.Environment;
import cloudiator.Hardware;
Expand Down Expand Up @@ -32,7 +33,12 @@ public class NodeCandidate implements Comparable<NodeCandidate> {

public NodeCandidate(Cloud cloud, Hardware hardware,
Image image, Location location, @Nullable Double price) {
this.type = NodeType.IAAS;

if (cloud.getType().equals(CloudType.SIMULATION)) {
this.type = NodeType.SIMULATION;
} else {
this.type = NodeType.IAAS;
}
this.cloud = cloud;
this.hardware = hardware;
this.image = image;
Expand Down Expand Up @@ -193,8 +199,18 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return MoreObjects.toStringHelper(this).add("hardware", hardware).add("image", image)
.add("location", location).add("price", price).toString();
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("type", type)
.add("cloud", cloud)
.add("location", location)
.add("hardware", hardware)
.add("image", image)
.add("price", price)
.add("pricePerInvocation", pricePerInvocation)
.add("memoryPrice", memoryPrice)
.add("environment", environment)
.toString();
}

@Override
Expand Down
Loading