Commit 616e7c4d authored by dietricf's avatar dietricf
Browse files

SONARWORK

parent 23764554
......@@ -16,9 +16,9 @@
package org.eclipse.openk.gridfailureinformation.bpmn.base.tasks;
import lombok.extern.log4j.Log4j2;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessTask;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessException;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessSubject;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessTask;
@Log4j2
public class EndPointTask implements ProcessTask {
......@@ -28,7 +28,7 @@ public class EndPointTask implements ProcessTask {
this.description = description;
}
@Override
public void enterStep(ProcessSubject model) throws ProcessException {
public void enterStep(ProcessSubject model) {
log.debug("Endpoint: \""+description+"\"");
}
......
......@@ -19,26 +19,26 @@ import lombok.Data;
import lombok.extern.log4j.Log4j2;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessState;
import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessSubject;
import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
@Log4j2
@Data
public class GfiProcessSubject implements ProcessSubject {
//private <Main Object>;
private FailureInformationDto failureInformationDto;
private String changeUser;
private ProcessState stateInDb;
private String jwt;
private GfiProcessSubject() {}
/*
private GfiProcessSubject(GridMeasure gm, String changeUser ) {
this.gridMeasure = gm;
private GfiProcessSubject(FailureInformationDto failureInformationDto, String changeUser ) {
this.failureInformationDto = failureInformationDto;
this.changeUser = changeUser;
}
public static GfiProcessSubject fromGridMeasure(GridMeasure gm, String changeUser ) {
return new GfiProcessSubject(gm, changeUser);
public static GfiProcessSubject of(FailureInformationDto failureInformationDto, String changeUser ) {
return new GfiProcessSubject(failureInformationDto, changeUser);
}
*/
}
......@@ -98,10 +98,13 @@ public class DecisionTaskTest {
}
}
@Test
public void testPort_invalid() throws ProcessException {
assertThrows( ProcessException.class, () -> testPort_portnumber(999) ); // should throw exception
}
@Test
public void test_onLeave_Exception() throws Exception {
setup();
TestProcessSubject subject = new TestProcessSubject();
......@@ -109,6 +112,7 @@ public class DecisionTaskTest {
// should raise exception
}
@Test
public void test_outputUnconnected() throws ProcessException {
TestProcessSubject subject = new TestProcessSubject();
subject.yes = true;
......
......@@ -19,6 +19,7 @@ import org.eclipse.openk.gridfailureinformation.bpmn.base.ProcessException;
import org.eclipse.openk.gridfailureinformation.bpmn.base.TestProcessSubject;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class EndpointTaskTest {
......@@ -27,17 +28,28 @@ public class EndpointTaskTest {
TestProcessSubject subject = new TestProcessSubject();
EndPointTask ep = new EndPointTask("Endpoint");
ep.enterStep(subject);
assertNotNull(ep);
}
@Test
public void testEndpoint_connectTo() throws ProcessException {
TestProcessSubject subject = new TestProcessSubject();
EndPointTask ep = new EndPointTask("Endpoint");
assertThrows(ProcessException.class, () -> ep.connectOutputTo(null) ) ;
}
@Test
public void testEndpoint_leaveStep() throws ProcessException {
TestProcessSubject subject = new TestProcessSubject();
EndPointTask ep = new EndPointTask("Endpoint");
assertThrows(ProcessException.class, () -> ep.leaveStep(subject) ) ;
}
@Test
public void testEndpoint_recover() throws ProcessException {
TestProcessSubject subject = new TestProcessSubject();
EndPointTask ep = new EndPointTask("Endpoint");
assertThrows(ProcessException.class, () -> ep.recover(subject) ) ;
}
}
......@@ -15,7 +15,15 @@
package org.eclipse.openk.gridfailureinformation.bpmn.impl;
import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class GfiProcessSubjectTest {
@Test
public void testSubjectCreation() {
GfiProcessSubject sub = GfiProcessSubject.of(new FailureInformationDto(), "whoami");
assertEquals( "whoami", sub.getChangeUser());
}
}
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