Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix Sonar and CheckStyle warnings
[nonrtric.git]
/
policy-agent
/
src
/
test
/
java
/
org
/
oransc
/
policyagent
/
tasks
/
RicSupervisionTest.java
diff --git
a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
index
3f8dd06
..
73ca351
100644
(file)
--- a/
policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
+++ b/
policy-agent/src/test/java/org/oransc/policyagent/tasks/RicSupervisionTest.java
@@
-104,11
+104,10
@@
public class RicSupervisionTest {
@BeforeEach
public void init() {
@BeforeEach
public void init() {
- doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
types.clear();
policies.clear();
rics.clear();
types.clear();
policies.clear();
rics.clear();
- RIC_1.setState(RicState.UN
DEFINED
);
+ RIC_1.setState(RicState.UN
AVAILABLE
);
RIC_1.clearSupportedPolicyTypes();
}
RIC_1.clearSupportedPolicyTypes();
}
@@
-123,7
+122,8
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
@Test
public void whenRicIdleAndNoChangedPoliciesOrPolicyTypes_thenNoSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@
-144,7
+144,8
@@
public class RicSupervisionTest {
@Test
public void whenRicUndefined_thenSynchronization() {
@Test
public void whenRicUndefined_thenSynchronization() {
- RIC_1.setState(RicState.UNDEFINED);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.UNAVAILABLE);
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
rics.put(RIC_1);
RicSupervision supervisorUnderTest = spy(new RicSupervision(rics, policies, a1ClientFactory, types, null));
@@
-161,6
+162,7
@@
public class RicSupervisionTest {
@Test
public void whenRicSynchronizing_thenNoSynchronization() {
@Test
public void whenRicSynchronizing_thenNoSynchronization() {
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
RIC_1.setState(RicState.SYNCHRONIZING);
rics.put(RIC_1);
RIC_1.setState(RicState.SYNCHRONIZING);
rics.put(RIC_1);
@@
-174,7
+176,8
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
@Test
public void whenRicIdleAndErrorGettingPolicyIdentities_thenNoSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@
-185,11
+188,13
@@
public class RicSupervisionTest {
verify(supervisorUnderTest).checkAllRics();
verifyNoMoreInteractions(supervisorUnderTest);
verify(supervisorUnderTest).checkAllRics();
verifyNoMoreInteractions(supervisorUnderTest);
+ assertThat(RIC_1.getState()).isEqualTo(RicState.UNAVAILABLE);
}
@Test
public void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
}
@Test
public void whenRicIdleAndNotSameAmountOfPolicies_thenSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
rics.put(RIC_1);
policies.put(POLICY_1);
rics.put(RIC_1);
policies.put(POLICY_1);
@@
-211,7
+216,8
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
@Test
public void whenRicIdleAndSameAmountOfPoliciesButNotSamePolicies_thenSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
rics.put(RIC_1);
policies.put(POLICY_1);
rics.put(RIC_1);
policies.put(POLICY_1);
@@
-233,7
+239,8
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() {
@Test
public void whenRicIdleAndErrorGettingPolicyTypes_thenNoSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@
-249,7
+256,8
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
@Test
public void whenRicIdleAndNotSameAmountOfPolicyTypes_thenSynchronization() {
- RIC_1.setState(RicState.IDLE);
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
+ RIC_1.setState(RicState.AVAILABLE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
rics.put(RIC_1);
@@
-272,12
+280,13
@@
public class RicSupervisionTest {
@Test
public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
@Test
public void whenRicIdleAndSameAmountOfPolicyTypesButNotSameTypes_thenSynchronization() {
+ doReturn(Mono.just(a1ClientMock)).when(a1ClientFactory).createA1Client(any(Ric.class));
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
.schema("") //
.build();
PolicyType policyType2 = ImmutablePolicyType.builder() //
.name("policyType2") //
.schema("") //
.build();
- RIC_1.setState(RicState.
ID
LE);
+ RIC_1.setState(RicState.
AVAILAB
LE);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
RIC_1.addSupportedPolicyType(policyType2);
rics.put(RIC_1);
RIC_1.addSupportedPolicyType(POLICY_TYPE_1);
RIC_1.addSupportedPolicyType(policyType2);
rics.put(RIC_1);