Commit b7c2798d authored by dietricf's avatar dietricf
Browse files

SONARWORK

parent bfb360a4
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package org.eclipse.openk.gridfailureinformation.bpmn.impl; package org.eclipse.openk.gridfailureinformation.bpmn.impl;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessException;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessGrid; import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessGrid;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -24,18 +23,7 @@ import org.springframework.stereotype.Component; ...@@ -24,18 +23,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class GfiGrid extends ProcessGrid { public class GfiGrid extends ProcessGrid {
public GfiGrid() { public GfiGrid() {
try {
init();
}
catch( ProcessException e ) {
log.fatal("Invalid process grid configuration", e );
throw new RuntimeException("Invalid process grid configuration"); // NOSONAR _fd
}
}
private void init() throws ProcessException {
// TODO: Create the Grid here // TODO: Create the Grid here
} }
} }
...@@ -20,6 +20,7 @@ import org.eclipse.openk.gridfailureinformation.bpmn.base.tasks.UserInteractionT ...@@ -20,6 +20,7 @@ import org.eclipse.openk.gridfailureinformation.bpmn.base.tasks.UserInteractionT
public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubject> { public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubject> {
public boolean leaveStepCalled = false; public boolean leaveStepCalled = false;
public boolean enterStepCalled = false; public boolean enterStepCalled = false;
public boolean stayInTask = false;
public UserInteractionTaskImpl(String description ) { public UserInteractionTaskImpl(String description ) {
super(description); super(description);
...@@ -30,6 +31,11 @@ public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubj ...@@ -30,6 +31,11 @@ public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubj
this.leaveStepCalled = true; this.leaveStepCalled = true;
} }
@Override
protected boolean isStayInThisTask(TestProcessSubject model){ // NOSONAR Parameter needed, if overridden
return stayInTask;
}
@Override @Override
protected void onEnterStep(TestProcessSubject model) throws ProcessException { protected void onEnterStep(TestProcessSubject model) throws ProcessException {
// implement empty // implement empty
...@@ -40,4 +46,5 @@ public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubj ...@@ -40,4 +46,5 @@ public class UserInteractionTaskImpl extends UserInteractionTask<TestProcessSubj
super.enterStep(model); super.enterStep(model);
this.enterStepCalled = true; this.enterStepCalled = true;
} }
} }
...@@ -27,6 +27,7 @@ public class UserInteractionTaskTest { ...@@ -27,6 +27,7 @@ public class UserInteractionTaskTest {
@Test @Test
public void testUserinteractionTask() throws ProcessException { public void testUserinteractionTask() throws ProcessException {
UserInteractionTaskImpl task=new UserInteractionTaskImpl("UI Task"); UserInteractionTaskImpl task=new UserInteractionTaskImpl("UI Task");
task.stayInTask = false;
TestProcessSubject subject = new TestProcessSubject(); TestProcessSubject subject = new TestProcessSubject();
task.enterStep( subject ); task.enterStep( subject );
assertTrue(task.enterStepCalled); assertTrue(task.enterStepCalled);
...@@ -37,4 +38,18 @@ public class UserInteractionTaskTest { ...@@ -37,4 +38,18 @@ public class UserInteractionTaskTest {
} }
@Test
public void testUserinteractionTaskStayInTask() throws ProcessException {
UserInteractionTaskImpl task=new UserInteractionTaskImpl("UI Task");
task.stayInTask = true;
TestProcessSubject subject = new TestProcessSubject();
task.enterStep( subject );
assertTrue(task.enterStepCalled);
assertFalse(task.leaveStepCalled);
task.leaveStep( subject );
assertFalse(task.leaveStepCalled);
}
} }
...@@ -18,6 +18,7 @@ package org.eclipse.openk.gridfailureinformation.bpmn.impl; ...@@ -18,6 +18,7 @@ package org.eclipse.openk.gridfailureinformation.bpmn.impl;
import org.eclipse.openk.gridfailureinformation.bpmn.base.*; import org.eclipse.openk.gridfailureinformation.bpmn.base.*;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
...@@ -38,4 +39,11 @@ public class GfiGridTest { ...@@ -38,4 +39,11 @@ public class GfiGridTest {
assertThrows(ProcessException.class, () -> theGrid.recover(subject).start(()-> ProcessStateImpl.UNREACHABLE) ); assertThrows(ProcessException.class, () -> theGrid.recover(subject).start(()-> ProcessStateImpl.UNREACHABLE) );
} }
// wegen intialer Testabdeckung
@Test
public void testGfiGridConstr() {
ProcessGrid grid = new GfiGrid();
assertNotNull(grid);
}
} }
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