Skip to content
Snippets Groups Projects
Commit 95ea9a6a authored by Simon Spinner's avatar Simon Spinner
Browse files

Integrate PlatformScope into LogicalInfrastructureScope.

parent de692c6d
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ import org.junit.Before;
import tools.descartes.prisma.core.TestMessageBus;
import tools.descartes.prisma.core.TestModelRepository;
public class HypervisorScopeTest extends ContainerScopeTest<VirtualInfrastructureScope> {
public class HypervisorScopeTest extends ContainerScopeTest<LogicalInfrastructureScope> {
private static final String NAME = "vsphere";
......@@ -17,9 +17,9 @@ public class HypervisorScopeTest extends ContainerScopeTest<VirtualInfrastructur
messageBus = new TestMessageBus();
repository = new TestModelRepository(messageBus);
Scope scope = repository.getScope("hypervisor/" + NAME);
assertThat(scope).isInstanceOf(VirtualInfrastructureScope.class);
assertThat(scope).isInstanceOf(LogicalInfrastructureScope.class);
scope.create();
this.scope = (VirtualInfrastructureScope) scope;
this.scope = (LogicalInfrastructureScope) scope;
}
}
......@@ -12,9 +12,12 @@ public class LogicalInfrastructureScope extends ContainerScope {
public static final String VIRTUAL_INFRASTRUCTURE_SCOPE_TYPE = "virtual";
public LogicalInfrastructureScope(String name, SystemGlobalScope systemScope, ModelRepository repository,
public static final String PLATFORM_SCOPE_TYPE = "platform";
public LogicalInfrastructureScope(String name, String type, SystemGlobalScope systemScope,
ModelRepository repository,
MessageBus messageBus) {
super(name, VIRTUAL_INFRASTRUCTURE_SCOPE_TYPE, systemScope, repository, messageBus);
super(name, type, systemScope, repository, messageBus);
}
public String getHypervisorExchange() {
......
package tools.descartes.prisma.core.scopes;
import edu.kit.ipd.descartes.mm.resourceconfiguration.ConfigurationSpecification;
import edu.kit.ipd.descartes.mm.resourcelandscape.RuntimeEnvironment;
import edu.kit.ipd.descartes.mm.runtimeenvironmentclasses.RuntimeEnvironmentClasses;
import tools.descartes.prisma.core.MessageBus;
import tools.descartes.prisma.core.ModelRepository;
import tools.descartes.prisma.model.sensor.Sensor;
public class PlatformScope extends ContainerScope {
public static final String PLATFORM_SCOPE_TYPE = "platform";
public PlatformScope(String name, SystemGlobalScope systemScope, ModelRepository repository,
MessageBus messageBus) {
super(name, PLATFORM_SCOPE_TYPE, systemScope, repository, messageBus);
}
public String getOperatingSystemExchange() {
return getName() + ".OperatingSystem";
}
public String getRuntimeEnvironmentExchange() {
return getName() + ".RuntimeEnvironment";
}
public String getConfigurationSpecificationExchange() {
return getName() + ".ConfigurationSpecification";
}
public String getPlatformSensorExchange() {
return getName() + ".PlatformSensor";
}
public String getPlatformStatisticsPort() {
return getName() + ".PlatformStatistics";
}
@Override
protected void createMessageExchanges() {
super.createMessageExchanges();
declareNotification(
new NotificationDefinition(RuntimeEnvironment.class, getOperatingSystemExchange()) {
@Override
public boolean isActive(Object o) {
if (super.isActive(o)) {
return ((RuntimeEnvironment) o).getOfClass() == RuntimeEnvironmentClasses.OPERATING_SYSTEM;
}
return false;
}
});
declareNotification(new NotificationDefinition(RuntimeEnvironment.class, getRuntimeEnvironmentExchange()));
declareNotification(new NotificationDefinition(ConfigurationSpecification.class,
getConfigurationSpecificationExchange()));
declareNotification(new NotificationDefinition(Sensor.class, getPlatformSensorExchange()));
declareIncomingPort(getOperatingSystemExchange());
declareStatisticsPort(getPlatformStatisticsPort());
}
}
......@@ -17,9 +17,12 @@ public class ScopeFactory {
case PhysicalInfrastructureScope.PHYSICAL_INFRASTRUCTURE_SCOPE_TYPE:
return new PhysicalInfrastructureScope(parts[1], systemScope, repository, messageBus);
case LogicalInfrastructureScope.VIRTUAL_INFRASTRUCTURE_SCOPE_TYPE:
return new LogicalInfrastructureScope(parts[1], systemScope, repository, messageBus);
case PlatformScope.PLATFORM_SCOPE_TYPE:
return new PlatformScope(parts[1], systemScope, repository, messageBus);
return new LogicalInfrastructureScope(parts[1],
LogicalInfrastructureScope.VIRTUAL_INFRASTRUCTURE_SCOPE_TYPE, systemScope, repository,
messageBus);
case LogicalInfrastructureScope.PLATFORM_SCOPE_TYPE:
return new LogicalInfrastructureScope(parts[1], LogicalInfrastructureScope.PLATFORM_SCOPE_TYPE,
systemScope, repository, messageBus);
case ModelVariableScope.MODEL_VARIABLE_SCOPE_TYPE:
return new ModelVariableScope(parts[1], systemScope, repository, messageBus);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment