Commit 214f0523 authored by dietricf's avatar dietricf
Browse files

SI-585 Correction of the grid; make "useStaticJwt" in localdev-yml true again.

parent 63d7fd4f
......@@ -31,13 +31,19 @@ import static org.eclipse.openk.gridfailureinformation.bpmn.impl.GfiProcessState
@Component
public class GfiGrid extends ProcessGrid {
public GfiGrid() throws ProcessException {
DecisionTask decidePlanned = register( NEW, new DecideFailureInfoPlanned());
DecisionTask decidePlanned = new DecideFailureInfoPlanned();
ProcessTask storeEditStatusPlanned = new StoreEditStatusServiceTask( PLANNED );
ProcessTask enterMessage = register( PLANNED,
new UIStoreFailureInformationTask("State PLANNED UI Task", true));
register( NEW, enterMessage );
ProcessTask storeEditStatusCreated = new StoreEditStatusServiceTask( CREATED );
ProcessTask qualifyMessage = register( CREATED,
new UIStoreFailureInformationTask( "State CREATED UI Task", true));
register( UPDATED, qualifyMessage);
DecisionTask decideCanceled = new DecideFailureInfoCanceled();
ProcessTask storeEditStatusQualified = new ShortcutTask( QUALIFIED );
ProcessTask storeEditStatusCanceled = new ShortcutTask( CANCELED );
......
......@@ -39,7 +39,7 @@ gridFailureInformation:
jwt:
tokenHeader: Authorization
useStaticJwt: false
useStaticJwt: true
staticJwt: eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIYlI3Z2pobmE2eXJRZnZJTWhUSV9tY2g3ZmtTQWVFX3hLTjBhZVl0bjdjIn0.eyJqdGkiOiJlMmQ2YjE3Zi1iMWUyLTQxMzUtOTM1YS0zOWRiMmFkMzE5MjYiLCJleHAiOjE1ODYwMTI1MzUsIm5iZiI6MCwiaWF0IjoxNTg2MDEyMjM1LCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjgwODAvYXV0aC9yZWFsbXMvRWxvZ2Jvb2siLCJhdWQiOiJlbG9nYm9vay1iYWNrZW5kIiwic3ViIjoiMzMzMmRmOWItYmYyMy00Nzg5LThmMmQtM2JhZTM2MzA4YzNkIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiZWxvZ2Jvb2stYmFja2VuZCIsImF1dGhfdGltZSI6MCwic2Vzc2lvbl9zdGF0ZSI6IjYxMzRmN2RhLTdlNjQtNDJjNy05NjYyLTY0ZGNhZTk1MjQ5YSIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiKiJdLCJyZWFsbV9hY2Nlc3MiOnsicm9sZXMiOlsiZ3JpZC1mYWlsdXJlLXF1YWxpZmllciIsImdyaWQtZmFpbHVyZS1jcmVhdG9yIiwiZ3JpZC1mYWlsdXJlLWFjY2VzcyIsImdyaWQtZmFpbHVyZS1hZG1pbiIsImdyaWQtZmFpbHVyZS1wdWJsaXNoZXIiXX0sInJlc291cmNlX2FjY2VzcyI6e30sIm5hbWUiOiJTdGF0aWMgSldUIiwicHJlZmVycmVkX3VzZXJuYW1lIjoidGVzdHVzZXJfZ2ZpX3N0YXRpY2p3dCIsImdpdmVuX25hbWUiOiJTdGF0aWMiLCJmYW1pbHlfbmFtZSI6IkpXVCJ9.SWpekZHxlDNWbaaZ2fHlts00c1Xi6yIb0ZMr9f8ujSI_6LVYuHx8FTt6g9tinyVcx5gQKfrooRW28Cdq1EVuexNtTtZ7ciKk4iEo_kgqUgRvHCwO7HQl2igpoGErheYD0kj3-u4Te6NPHKtXWIEfGyl0ZQBD2c4vtaCTQAy5Ilb146G7p_IcLYaZgpJPlGG0Bf2oZ0UqTQsrXxRJkXWARDz8D4lIrN84lAbqNlPlSZDN-8xp_z6mXgWpvgeZuFoYHItJMg2cjR0SXH-ycbWVXctRNQJfTWR0acIhp_nB_Xe6JlUx2vls99EVw-WUrd0hc8Y9658HdeyktvpQLDxP2g
services:
......
......@@ -59,25 +59,4 @@ public class DecideFailureInfoPlannedTest {
.setEditStatusAndStore(any( UUID.class ), eq(GfiProcessState.CREATED));
}
@Test
public void shouldcall_DecideFailureInfoPlanned_Result_Planned() {
RefStatus refStatus = MockDataHelper.mockRefStatus();
refStatus.setId(GfiProcessState.NEW.getStatusValue());
FailureInformationDto fiDto = MockDataHelper.mockFailureInformationDto();
fiDto.setStatusInternId(UUID.randomUUID());
TblFailureInformation fiTbl = MockDataHelper.mockTblFailureInformation();
fiTbl.setId(777L);
when(processHelper.isFailureInfoPlanned(any( FailureInformationDto.class ))).thenReturn(true);
when(statusRepository.findByUuid(any( UUID.class ))).thenReturn(Optional.of(refStatus));
when(failureInformationRepository.findByUuid(any(UUID.class))).thenReturn(Optional.of(fiTbl));
when(failureInformationRepository.save(any(TblFailureInformation.class))).thenReturn(fiTbl);
FailureInformationDto savedDto = failureInformationService.updateFailureInfo(fiDto);
verify(processHelper, times(1))
.setEditStatusAndStore(any( UUID.class ), eq(GfiProcessState.PLANNED));
}
}
......@@ -16,13 +16,47 @@
package org.eclipse.openk.gridfailureinformation.bpmn.impl;
import org.eclipse.openk.gridfailureinformation.bpmn.base.*;
import org.eclipse.openk.gridfailureinformation.bpmn.impl.tasks.ProcessHelper;
import org.eclipse.openk.gridfailureinformation.config.TestConfiguration;
import org.eclipse.openk.gridfailureinformation.model.RefStatus;
import org.eclipse.openk.gridfailureinformation.model.TblFailureInformation;
import org.eclipse.openk.gridfailureinformation.repository.FailureInformationRepository;
import org.eclipse.openk.gridfailureinformation.repository.StatusRepository;
import org.eclipse.openk.gridfailureinformation.service.FailureInformationService;
import org.eclipse.openk.gridfailureinformation.support.MockDataHelper;
import org.eclipse.openk.gridfailureinformation.viewmodel.FailureInformationDto;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.ContextConfiguration;
import java.util.Optional;
import java.util.UUID;
import static org.hibernate.validator.internal.util.Contracts.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.*;
@DataJpaTest
@ContextConfiguration(classes = {TestConfiguration.class})
public class GfiGridTest {
@Qualifier("myFailureInformationService")
@Autowired
private FailureInformationService failureInformationService;
@MockBean
private ProcessHelper processHelper;
@MockBean
private StatusRepository statusRepository;
@MockBean
private FailureInformationRepository failureInformationRepository;
@Test
public void testProcessGrid() throws ProcessException {
ProcessGridImpl theGrid = new ProcessGridImpl();
......@@ -46,4 +80,37 @@ public class GfiGridTest {
assertNotNull(grid);
}
@Test
public void shouldEndInQualifyMessageWhenStoredWithCreatedFromDBStateNew() {
FailureInformationDto dtoToSave = MockDataHelper.mockFailureInformationDto();
TblFailureInformation failureFromDB = MockDataHelper.mockTblFailureInformation();
RefStatus refStatusFromDB = MockDataHelper.mockRefStatus();
refStatusFromDB.setId(GfiProcessState.NEW.getStatusValue());
when( failureInformationRepository.findByUuid(eq(dtoToSave.getUuid()))).thenReturn(Optional.of(failureFromDB));
when( statusRepository.findByUuid(eq(failureFromDB.getRefStatusIntern().getUuid()))).thenReturn(Optional.of(refStatusFromDB));
failureInformationService.updateFailureInfo(dtoToSave);
verify(processHelper, times(1))
.setEditStatusAndStore(any( UUID.class ), eq(GfiProcessState.CREATED));
}
@Test
public void shouldEndInQualifyMessageWhenStoredWithCreatedFromDBStatePlanned() {
FailureInformationDto dtoToSave = MockDataHelper.mockFailureInformationDto();
TblFailureInformation failureFromDB = MockDataHelper.mockTblFailureInformation();
RefStatus refStatusFromDB = MockDataHelper.mockRefStatus();
refStatusFromDB.setId(GfiProcessState.PLANNED.getStatusValue());
when( failureInformationRepository.findByUuid(eq(dtoToSave.getUuid()))).thenReturn(Optional.of(failureFromDB));
when( statusRepository.findByUuid(eq(failureFromDB.getRefStatusIntern().getUuid()))).thenReturn(Optional.of(refStatusFromDB));
failureInformationService.updateFailureInfo(dtoToSave);
verify(processHelper, times(1))
.setEditStatusAndStore(eq(dtoToSave.getUuid()), eq(GfiProcessState.CREATED));
}
}
......@@ -86,4 +86,6 @@ public class UIStoreFailureInformationTaskTest {
assertTrue(task.onLeaveStepCalled);
}
}
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