Skip to content

Commit

Permalink
Re-enabled ignored tests; handled ripples on other tests (#130, #131)
Browse files Browse the repository at this point in the history
  • Loading branch information
climategadgets committed May 18, 2021
1 parent 4f5611f commit 27d1eed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class THTest {
private static final String WRONG_POSITION = "wrong position";
private static final String WRONG_STATE = "wrong switch state";

@Ignore
@Test
public void moveGroup() throws Exception {
ThreadContext.push("moveGroup");
Expand Down Expand Up @@ -80,7 +79,6 @@ public void moveGroup() throws Exception {
}
}

@Ignore
@Test
public void lockUp() throws Exception {
ThreadContext.push("lockUp");
Expand Down Expand Up @@ -138,7 +136,6 @@ public void testSyncSlowSimple()
testSync("slow/simple", SimpleDamperController.class, 100, 500);
}

@Ignore
@Test
public void testSyncFastBalancing()
throws InterruptedException, ExecutionException, IOException, NoSuchMethodException, SecurityException,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.sf.dz3.device.actuator.impl;

import java.io.IOException;
import java.util.concurrent.ExecutionException;

import org.apache.logging.log4j.ThreadContext;

Expand Down Expand Up @@ -72,7 +73,7 @@ public class SwitchDamper extends AbstractDamper {
* @param heartbeatSeconds The command to set the position will not be sent to the actual switch
* more often than once in this many seconds.
*/
public SwitchDamper(String name, Switch target, double threshold, int heartbeatSeconds) {
public SwitchDamper(String name, Switch target, double threshold, int heartbeatSeconds) throws IOException {

this(name, target, threshold, 1.0, heartbeatSeconds, false);
}
Expand All @@ -87,7 +88,7 @@ public SwitchDamper(String name, Switch target, double threshold, int heartbeatS
* @param heartbeatSeconds The command to set the position will not be sent to the actual switch
* more often than once in this many seconds.
*/
public SwitchDamper(String name, Switch target, double threshold, double parkPosition, int heartbeatSeconds) {
public SwitchDamper(String name, Switch target, double threshold, double parkPosition, int heartbeatSeconds) throws IOException {

this(name, target, threshold, parkPosition, heartbeatSeconds, false);
}
Expand All @@ -103,7 +104,7 @@ public SwitchDamper(String name, Switch target, double threshold, double parkPos
* more often than once in this many seconds.
* @param inverted {@code true} if the switch position needs to be inverted.
*/
public SwitchDamper(String name, Switch target, double threshold, double parkPosition, int heartbeatSeconds, boolean inverted) {
public SwitchDamper(String name, Switch target, double threshold, double parkPosition, int heartbeatSeconds, boolean inverted) throws IOException {

super(name);

Expand All @@ -123,7 +124,11 @@ public SwitchDamper(String name, Switch target, double threshold, double parkPos

setParkPosition(parkPosition);

set(getParkPosition());
try {
set(getParkPosition()).get();
} catch (InterruptedException | ExecutionException ex) {
throw new IOException("can't set switch position", ex);
}
}

private void check(Switch target) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class SwitchDamperTest extends TestCase {
/**
* Test whether the {@link SwitchDamper} is properly parked.
*/
public void testPark() {
public void testPark() throws IOException {

NullSwitch s = new NullSwitch("switch");
Damper d = new SwitchDamper("damper", s, 0.5, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public void testNaN() throws InterruptedException, ExecutionException {

assertTrue(status.isOK());

// VT: NOTE: Need this because of asynchronous nature of damper transitions
logger.debug("about to assert");
damperController.powerOff().get();

assertEquals("Wrong damper position", d1.getParkPosition(), d1.get(), 0.000000000001);

Expand Down

0 comments on commit 27d1eed

Please sign in to comment.