Skip to content

Commit

Permalink
Merge branch 'newgen' of https://github.com/d3scomp/JDEECo.git into n…
Browse files Browse the repository at this point in the history
…ewgen
  • Loading branch information
Michał Kit committed Nov 11, 2013
2 parents 123a3a7 + a9db5ee commit 80ca546
Show file tree
Hide file tree
Showing 4 changed files with 525 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,27 @@ public class RuntimeFrameworkImpl implements RuntimeFramework {
*/
public RuntimeFrameworkImpl(RuntimeMetadata model, Scheduler scheduler,
Executor executor, KnowledgeManagerContainer kmContainer) {
this(model, scheduler, executor, kmContainer, true);
}

RuntimeFrameworkImpl(RuntimeMetadata model, Scheduler scheduler,
Executor executor, KnowledgeManagerContainer kmContainer, boolean autoInit) {
if (model == null)
throw new IllegalArgumentException("Model cannot be null");
if (scheduler == null)
throw new IllegalArgumentException("Scheduler cannot be null");
if (executor == null)
throw new IllegalArgumentException("Executor cannot be null");
if (kmContainer == null)
throw new IllegalArgumentException("KnowledgeManagerContainer cannot be null");

this.scheduler = scheduler;
this.model = model;
this.executor = executor;
this.kmContainer = kmContainer;

init();
if (autoInit)
init();
}

/**
Expand Down Expand Up @@ -184,8 +199,9 @@ void componentInstanceRemoved(ComponentInstance instance) {

ComponentInstanceRecord ciRecord = componentRecords.get(instance);

for (ComponentProcess p: ciRecord.getProcessTasks().keySet()) {
componentProcessRemoved(instance, p);
while (!ciRecord.getProcessTasks().isEmpty()) {
ComponentProcess p = ciRecord.getProcessTasks().keySet().iterator().next();
componentProcessRemoved(instance, p);
}

for (Task t: ciRecord.getEnsembleTasks().values()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package cz.cuni.mff.d3s.deeco.runtime;

import org.junit.*;
import static org.junit.Assert.*;

/**
* The class <code>RuntimeConfigurationTest</code> contains tests for the class <code>{@link RuntimeConfiguration}</code>.
*
* @generatedBy CodePro at 8.11.13 10:33
* @author Jaroslav Keznikl <keznikl@d3s.mff.cuni.cz>
*
*/
public class RuntimeConfigurationTest {
/**
* Run the RuntimeConfiguration(Scheduling,Distribution,Execution) constructor test.
*
* @throws Exception
*
* @generatedBy CodePro at 8.11.13 10:33
*/
@Test
public void testRuntimeConfiguration()
throws Exception {
RuntimeConfiguration.Scheduling scheduling = RuntimeConfiguration.Scheduling.WALL_TIME;
RuntimeConfiguration.Distribution distribution = RuntimeConfiguration.Distribution.LOCAL;
RuntimeConfiguration.Execution execution = RuntimeConfiguration.Execution.SINGLE_THREADED;

RuntimeConfiguration result = new RuntimeConfiguration(scheduling, distribution, execution);

// add additional test code here
assertNotNull(result);
assertEquals("RuntimeConfiguration [scheduling=WALL_TIME, distribution=LOCAL, execution=SINGLE_THREADED]", result.toString());
}

/**
* Run the RuntimeConfiguration.Distribution getDistribution() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 8.11.13 10:33
*/
@Test
public void testGetDistribution()
throws Exception {
RuntimeConfiguration fixture = new RuntimeConfiguration(RuntimeConfiguration.Scheduling.WALL_TIME, RuntimeConfiguration.Distribution.LOCAL, RuntimeConfiguration.Execution.SINGLE_THREADED);

RuntimeConfiguration.Distribution result = fixture.getDistribution();

// add additional test code here
assertNotNull(result);
assertEquals("LOCAL", result.toString());
assertEquals("LOCAL", result.name());
assertEquals(0, result.ordinal());
}

/**
* Run the RuntimeConfiguration.Execution getExecution() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 8.11.13 10:33
*/
@Test
public void testGetExecution()
throws Exception {
RuntimeConfiguration fixture = new RuntimeConfiguration(RuntimeConfiguration.Scheduling.WALL_TIME, RuntimeConfiguration.Distribution.LOCAL, RuntimeConfiguration.Execution.SINGLE_THREADED);

RuntimeConfiguration.Execution result = fixture.getExecution();

// add additional test code here
assertNotNull(result);
assertEquals("SINGLE_THREADED", result.toString());
assertEquals("SINGLE_THREADED", result.name());
assertEquals(0, result.ordinal());
}

/**
* Run the RuntimeConfiguration.Scheduling getScheduling() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 8.11.13 10:33
*/
@Test
public void testGetScheduling()
throws Exception {
RuntimeConfiguration fixture = new RuntimeConfiguration(RuntimeConfiguration.Scheduling.WALL_TIME, RuntimeConfiguration.Distribution.LOCAL, RuntimeConfiguration.Execution.SINGLE_THREADED);

RuntimeConfiguration.Scheduling result = fixture.getScheduling();

// add additional test code here
assertNotNull(result);
assertEquals("WALL_TIME", result.toString());
assertEquals("WALL_TIME", result.name());
assertEquals(0, result.ordinal());
}

/**
* Run the String toString() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 8.11.13 10:33
*/
@Test
public void testToString()
throws Exception {
RuntimeConfiguration fixture = new RuntimeConfiguration(RuntimeConfiguration.Scheduling.WALL_TIME, RuntimeConfiguration.Distribution.LOCAL, RuntimeConfiguration.Execution.SINGLE_THREADED);

String result = fixture.toString();

// add additional test code here
assertEquals("RuntimeConfiguration [scheduling=WALL_TIME, distribution=LOCAL, execution=SINGLE_THREADED]", result);
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ public class RuntimeFrameworkBuilderTest {
public ExpectedException thrown = ExpectedException.none();


@Test
public void testRuntimeFrameworkBuilderValidConfiguration()
throws Exception {
RuntimeConfiguration configuration = new RuntimeConfiguration(RuntimeConfiguration.Scheduling.WALL_TIME, RuntimeConfiguration.Distribution.LOCAL, RuntimeConfiguration.Execution.SINGLE_THREADED);

RuntimeFrameworkBuilder result = new RuntimeFrameworkBuilder(configuration);

// add additional test code here
assertNotNull(result);
}


@Test
public void testInitNullConfiguration() {
Expand Down
Loading

0 comments on commit 80ca546

Please sign in to comment.