Code Review
/
nonrtric.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Updates of the policy agent NBI
[nonrtric.git]
/
policy-agent
/
src
/
test
/
java
/
org
/
oransc
/
policyagent
/
tasks
/
RepositorySupervisionTest.java
diff --git
a/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
b/policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
index
4bbe316
..
fb8d46f
100644
(file)
--- a/
policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
+++ b/
policy-agent/src/test/java/org/oransc/policyagent/tasks/RepositorySupervisionTest.java
@@
-29,15
+29,13
@@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import java.util.Arrays;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import java.util.Arrays;
-import java.util.
Collection
;
+import java.util.
List
;
import java.util.Vector;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import java.util.Vector;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
-import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;
import org.oransc.policyagent.clients.A1Client;
import org.oransc.policyagent.clients.A1ClientFactory;
import org.mockito.junit.jupiter.MockitoExtension;
import org.oransc.policyagent.clients.A1Client;
import org.oransc.policyagent.clients.A1ClientFactory;
@@
-52,10
+50,11
@@
import org.oransc.policyagent.repository.Ric;
import org.oransc.policyagent.repository.Ric.RicState;
import org.oransc.policyagent.repository.Rics;
import org.oransc.policyagent.repository.Services;
import org.oransc.policyagent.repository.Ric.RicState;
import org.oransc.policyagent.repository.Rics;
import org.oransc.policyagent.repository.Services;
+
+import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@ExtendWith(MockitoExtension.class)
import reactor.core.publisher.Mono;
@ExtendWith(MockitoExtension.class)
-@RunWith(MockitoJUnitRunner.class)
public class RepositorySupervisionTest {
@Mock
A1Client a1ClientMock;
public class RepositorySupervisionTest {
@Mock
A1Client a1ClientMock;
@@
-109,24
+108,24
@@
public class RepositorySupervisionTest {
PolicyTypes types = new PolicyTypes();
Services services = new Services();
PolicyTypes types = new PolicyTypes();
Services services = new Services();
- RepositorySupervision supervisorUnderTest =
- new RepositorySupervision(rics, policies, a1ClientFactory, types, services);
-
- Mono<Collection<String>> policyIds = Mono.just(Arrays.asList("policyId1", "policyId2"));
+ Mono<List<String>> policyIds = Mono.just(Arrays.asList("policyId1", "policyId2"));
doReturn(policyIds).when(a1ClientMock).getPolicyTypeIdentities();
doReturn(policyIds).when(a1ClientMock).getPolicyIdentities();
doReturn(policyIds).when(a1ClientMock).getPolicyTypeIdentities();
doReturn(policyIds).when(a1ClientMock).getPolicyIdentities();
- doReturn(Mono.empty()).when(a1ClientMock).deletePolicy(anyString());
doReturn(Mono.just("schema")).when(a1ClientMock).getPolicyTypeSchema(anyString());
doReturn(Mono.just("OK")).when(a1ClientMock).putPolicy(any());
doReturn(Mono.just("schema")).when(a1ClientMock).getPolicyTypeSchema(anyString());
doReturn(Mono.just("OK")).when(a1ClientMock).putPolicy(any());
+ doReturn(Flux.empty()).when(a1ClientMock).deleteAllPolicies();
+
+ RepositorySupervision supervisorUnderTest =
+ new RepositorySupervision(rics, policies, a1ClientFactory, types, services);
supervisorUnderTest.checkAllRics();
supervisorUnderTest.checkAllRics();
- await().untilAsserted(() -> RicState.IDLE.equals(ric1.
s
tate()));
- await().untilAsserted(() -> RicState.IDLE.equals(ric2.
s
tate()));
- await().untilAsserted(() -> RicState.IDLE.equals(ric3.
s
tate()));
+ await().untilAsserted(() -> RicState.IDLE.equals(ric1.
getS
tate()));
+ await().untilAsserted(() -> RicState.IDLE.equals(ric2.
getS
tate()));
+ await().untilAsserted(() -> RicState.IDLE.equals(ric3.
getS
tate()));
- verify(a1ClientMock, times(3)).delete
Policy("policyId2"
);
+ verify(a1ClientMock, times(3)).delete
AllPolicies(
);
verifyNoMoreInteractions(a1ClientMock);
}
}
verifyNoMoreInteractions(a1ClientMock);
}
}