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

SONARWORK

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