Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse openK User Modules
org.eclipse.openk-usermodules.gridFailureInformation.backend
Commits
b7c33aad
Commit
b7c33aad
authored
Mar 10, 2020
by
Ina Curdt
Browse files
SI-194, SI-253
parent
d6f7d99c
Changes
4
Hide whitespace changes
Inline
Side-by-side
gfsBackendService/src/main/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationService.java
View file @
b7c33aad
...
...
@@ -84,7 +84,7 @@ public class FailureInformationService {
setFromGridFailureInformationDto
(
tblFailureInformationToSave
,
failureInfoDto
);
// Holen der nächste
s
Versionsnummer mit Hilfe der History-Tabelle
// Holen der nächste
n
Versionsnummer mit Hilfe der History-Tabelle
Long
countVersions
=
htblfailureInformationRepository
.
countByUuid
(
failureInfoDto
.
getUuid
());
tblFailureInformationToSave
.
setVersionNumber
(
countVersions
+
1
);
...
...
gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/controller/FailureInformationControllerTest.java
View file @
b7c33aad
...
...
@@ -122,9 +122,6 @@ public class FailureInformationControllerTest {
.
andExpect
(
jsonPath
(
"$.internExtern"
,
is
(
failureInfoDto
.
getInternExtern
())))
.
andExpect
(
jsonPath
(
"$.voltageLevel"
,
is
(
failureInfoDto
.
getVoltageLevel
())))
.
andExpect
(
jsonPath
(
"$.pressureLevel"
,
is
(
failureInfoDto
.
getPressureLevel
())))
//.andExpect(jsonPath("$.failureBegin", is(failureInfoDto.getFailureBegin().toString())))
//.andExpect(jsonPath("$.failureEndPlanned", is(failureInfoDto.getFailureEndPlanned().toString())))
//.andExpect(jsonPath("$.failureEndResupplied", is(failureInfoDto.getFailureEndResupplied().toString())))
.
andExpect
(
jsonPath
(
"$.probableReason"
,
is
(
failureInfoDto
.
getProbableReason
())))
.
andExpect
(
jsonPath
(
"$.internalRemark"
,
is
(
failureInfoDto
.
getInternalRemark
())))
.
andExpect
(
jsonPath
(
"$.postcode"
,
is
(
failureInfoDto
.
getPostcode
())))
...
...
gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/service/FailureInformationServiceTest.java
View file @
b7c33aad
...
...
@@ -55,6 +55,8 @@ public class FailureInformationServiceTest {
private
FailureTypeRepository
failureTypeRepository
;
@MockBean
private
StatusRepository
statusRepository
;
@MockBean
private
HtblFailureInformationRepository
htblFailureInformationRepository
;
@Test
public
void
shouldFindFailureInformations
()
{
...
...
@@ -98,12 +100,17 @@ public class FailureInformationServiceTest {
when
(
failureClassificationRepository
.
findByUuid
(
any
(
UUID
.
class
))).
thenReturn
(
Optional
.
of
(
refFailureClassification
));
when
(
failureTypeRepository
.
findByUuid
(
any
(
UUID
.
class
))).
thenReturn
(
Optional
.
of
(
refFailureType
));
when
(
statusRepository
.
findByUuid
(
any
(
UUID
.
class
))).
thenReturn
(
Optional
.
of
(
refStatus
));
when
(
htblFailureInformationRepository
.
countByUuid
(
any
(
UUID
.
class
))).
thenReturn
(
5L
);
when
(
failureInformationRepository
.
save
(
any
(
TblFailureInformation
.
class
))).
thenReturn
(
fiTbl
);
when
(
failureInformationRepository
.
save
(
any
(
TblFailureInformation
.
class
)))
.
then
((
Answer
<
TblFailureInformation
>)
invocation
->
{
Object
[]
args
=
invocation
.
getArguments
();
return
(
TblFailureInformation
)
args
[
0
];
});
FailureInformationDto
savedDto
=
failureInformationService
.
updateFailureInfo
(
fiDto
);
assertEquals
(
fiTbl
.
getUuid
(),
savedDto
.
getUuid
()
);
assertEquals
(
savedDto
.
getVersionNumber
(),
6L
);
assertEquals
(
fiTbl
.
getResponsibility
(),
savedDto
.
getResponsibility
());
assertEquals
(
fiTbl
.
getInternExtern
(),
savedDto
.
getInternExtern
());
assertEquals
(
fiTbl
.
getVoltageLevel
(),
savedDto
.
getVoltageLevel
());
...
...
@@ -157,6 +164,7 @@ public class FailureInformationServiceTest {
FailureInformationDto
savedDto
=
failureInformationService
.
updateFailureInfo
(
fiDto
);
assertEquals
(
fiTbl
.
getUuid
(),
savedDto
.
getUuid
());
assertEquals
(
fiTbl
.
getVersionNumber
(),
savedDto
.
getVersionNumber
());
assertEquals
(
fiTbl
.
getResponsibility
(),
savedDto
.
getResponsibility
());
assertEquals
(
fiTbl
.
getInternExtern
(),
savedDto
.
getInternExtern
());
assertEquals
(
fiTbl
.
getVoltageLevel
(),
savedDto
.
getVoltageLevel
());
...
...
@@ -336,6 +344,7 @@ public class FailureInformationServiceTest {
FailureInformationDto
savedDto
=
failureInformationService
.
insertFailureInfo
(
fiDto
);
assertNotNull
(
savedDto
.
getUuid
());
assertEquals
(
1L
,
savedDto
.
getVersionNumber
());
assertEquals
(
fiDto
.
getResponsibility
(),
savedDto
.
getResponsibility
());
assertEquals
(
fiDto
.
getInternExtern
(),
savedDto
.
getInternExtern
());
assertEquals
(
fiDto
.
getVoltageLevel
(),
savedDto
.
getVoltageLevel
());
...
...
gfsBackendService/src/test/java/org/eclipse/openk/gridfailureinformation/support/MockDataHelper.java
View file @
b7c33aad
...
...
@@ -53,6 +53,7 @@ public class MockDataHelper {
public
static
FailureInformationDto
mockFailureInformationDto
()
{
FailureInformationDto
dto
=
new
FailureInformationDto
();
dto
.
setUuid
(
UUID
.
randomUUID
());
dto
.
setVersionNumber
(
3L
);
dto
.
setResponsibility
(
"Vatter Abraham"
);
dto
.
setInternExtern
(
INTERNAL_SHORT
);
dto
.
setVoltageLevel
(
Constants
.
VOLTAGE_LEVEL_MS
);
...
...
@@ -89,6 +90,7 @@ public class MockDataHelper {
public
static
TblFailureInformation
mockTblFailureInformation
()
{
TblFailureInformation
obj
=
new
TblFailureInformation
();
obj
.
setUuid
(
UUID
.
randomUUID
());
obj
.
setVersionNumber
(
4L
);
obj
.
setResponsibility
(
"Vatter Abraham"
);
obj
.
setInternExtern
(
INTERNAL_SHORT
);
obj
.
setVoltageLevel
(
Constants
.
VOLTAGE_LEVEL_MS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment