mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 11:37:49 +00:00
Wifi-999: JUnit updates opensync-gateway and opensync-ext-cloud
This commit is contained in:
1
opensync-ext-interface/.gitignore
vendored
Normal file
1
opensync-ext-interface/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/target/
|
||||||
1
opensync-ext-static/.gitignore
vendored
Normal file
1
opensync-ext-static/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/target/
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
<includes>
|
<includes>
|
||||||
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
||||||
</includes>
|
</includes>
|
||||||
<useProjectArtifact>false</useProjectArtifact>
|
<useProjectArtifact>true</useProjectArtifact>
|
||||||
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
||||||
</dependencySet>
|
</dependencySet>
|
||||||
</dependencySets>
|
</dependencySets>
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
<includes>
|
<includes>
|
||||||
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
<include>com.telecominfraproject.wlan:opensync-gateway-static-process:jar</include>
|
||||||
</includes>
|
</includes>
|
||||||
<useProjectArtifact>false</useProjectArtifact>
|
<useProjectArtifact>true</useProjectArtifact>
|
||||||
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
<outputFileNameMapping>app.jar</outputFileNameMapping>
|
||||||
</dependencySet>
|
</dependencySet>
|
||||||
</dependencySets>
|
</dependencySets>
|
||||||
|
|||||||
1
opensync-gateway-static-process/.gitignore
vendored
Normal file
1
opensync-gateway-static-process/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/target/
|
||||||
1
opensync-gateway/.gitignore
vendored
Normal file
1
opensync-gateway/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/target/
|
||||||
@@ -167,7 +167,6 @@ public class OvsdbDaoTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConfigureGreTunnels() throws Exception {
|
public void testConfigureGreTunnels() throws Exception {
|
||||||
// test create 2 gre tunnel profiles
|
|
||||||
List<Row> rows = new ArrayList<>();
|
List<Row> rows = new ArrayList<>();
|
||||||
OperationResult[] operationResult = new OperationResult[] { new SelectResult(rows) };
|
OperationResult[] operationResult = new OperationResult[] { new SelectResult(rows) };
|
||||||
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList()))
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList()))
|
||||||
@@ -186,6 +185,34 @@ public class OvsdbDaoTest {
|
|||||||
tunnelProfileDetails.setGreParentIfName("wan");
|
tunnelProfileDetails.setGreParentIfName("wan");
|
||||||
apProfile.setDetails(tunnelProfileDetails);
|
apProfile.setDetails(tunnelProfileDetails);
|
||||||
|
|
||||||
|
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
||||||
|
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
||||||
|
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
||||||
|
// 1 call to check existence, 1 to add profile
|
||||||
|
Mockito.verify(ovsdbClient, Mockito.times(2)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
||||||
|
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigureGreTunnelsWithNoLocalAddress() throws Exception {
|
||||||
|
List<Row> rows = new ArrayList<>();
|
||||||
|
OperationResult[] operationResult = new OperationResult[] { new SelectResult(rows) };
|
||||||
|
Mockito.when(ovsdbClient.transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList()))
|
||||||
|
.thenReturn(selectionFutureResult);
|
||||||
|
Mockito.when(selectionFutureResult.get(30, TimeUnit.SECONDS)).thenReturn(operationResult);
|
||||||
|
Profile apProfile = new Profile();
|
||||||
|
apProfile.setCustomerId(2);
|
||||||
|
apProfile.setId(1L);
|
||||||
|
apProfile.setName("ApProfile");
|
||||||
|
apProfile.setProfileType(ProfileType.equipment_ap);
|
||||||
|
ApNetworkConfiguration tunnelProfileDetails = ApNetworkConfiguration.createWithDefaults();
|
||||||
|
|
||||||
|
tunnelProfileDetails.setGreRemoteInetAddr(InetAddress.getByName("192.168.0.10"));
|
||||||
|
tunnelProfileDetails.setGreTunnelName("gre1");
|
||||||
|
tunnelProfileDetails.setGreParentIfName("wan");
|
||||||
|
apProfile.setDetails(tunnelProfileDetails);
|
||||||
|
|
||||||
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
||||||
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
||||||
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
||||||
@@ -194,6 +221,76 @@ public class OvsdbDaoTest {
|
|||||||
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigureGreTunnelsWithNoRemoteAddress() throws Exception {
|
||||||
|
Profile apProfile = new Profile();
|
||||||
|
apProfile.setCustomerId(2);
|
||||||
|
apProfile.setId(1L);
|
||||||
|
apProfile.setName("ApProfile");
|
||||||
|
apProfile.setProfileType(ProfileType.equipment_ap);
|
||||||
|
ApNetworkConfiguration tunnelProfileDetails = ApNetworkConfiguration.createWithDefaults();
|
||||||
|
|
||||||
|
tunnelProfileDetails.setGreLocalInetAddr(InetAddress.getByName("10.0.10.10"));
|
||||||
|
tunnelProfileDetails.setGreTunnelName("gre1");
|
||||||
|
tunnelProfileDetails.setGreParentIfName("wan");
|
||||||
|
apProfile.setDetails(tunnelProfileDetails);
|
||||||
|
|
||||||
|
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
||||||
|
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
||||||
|
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
||||||
|
// Should not create
|
||||||
|
Mockito.verify(ovsdbClient, Mockito.times(0)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
||||||
|
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigureGreTunnelsWithNoParentInterface() throws Exception {
|
||||||
|
Profile apProfile = new Profile();
|
||||||
|
apProfile.setCustomerId(2);
|
||||||
|
apProfile.setId(1L);
|
||||||
|
apProfile.setName("ApProfile");
|
||||||
|
apProfile.setProfileType(ProfileType.equipment_ap);
|
||||||
|
ApNetworkConfiguration tunnelProfileDetails = ApNetworkConfiguration.createWithDefaults();
|
||||||
|
|
||||||
|
tunnelProfileDetails.setGreLocalInetAddr(InetAddress.getByName("10.0.10.10"));
|
||||||
|
tunnelProfileDetails.setGreRemoteInetAddr(InetAddress.getByName("192.168.0.10"));
|
||||||
|
tunnelProfileDetails.setGreTunnelName("gre1");
|
||||||
|
apProfile.setDetails(tunnelProfileDetails);
|
||||||
|
|
||||||
|
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
||||||
|
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
||||||
|
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
||||||
|
// Should not create
|
||||||
|
Mockito.verify(ovsdbClient, Mockito.times(0)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
||||||
|
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testConfigureGreTunnelsWithNoTunnelName() throws Exception {
|
||||||
|
Profile apProfile = new Profile();
|
||||||
|
apProfile.setCustomerId(2);
|
||||||
|
apProfile.setId(1L);
|
||||||
|
apProfile.setName("ApProfile");
|
||||||
|
apProfile.setProfileType(ProfileType.equipment_ap);
|
||||||
|
ApNetworkConfiguration tunnelProfileDetails = ApNetworkConfiguration.createWithDefaults();
|
||||||
|
|
||||||
|
tunnelProfileDetails.setGreLocalInetAddr(InetAddress.getByName("10.0.10.10"));
|
||||||
|
tunnelProfileDetails.setGreRemoteInetAddr(InetAddress.getByName("192.168.0.10"));
|
||||||
|
tunnelProfileDetails.setGreParentIfName("wan");
|
||||||
|
|
||||||
|
apProfile.setDetails(tunnelProfileDetails);
|
||||||
|
|
||||||
|
OpensyncAPConfig apConfig = Mockito.mock(OpensyncAPConfig.class);
|
||||||
|
Mockito.when(apConfig.getApProfile()).thenReturn(apProfile);
|
||||||
|
ovsdbDao.configureGreTunnels(ovsdbClient, apConfig);
|
||||||
|
// Should not create
|
||||||
|
Mockito.verify(ovsdbClient, Mockito.times(0)).transact(Mockito.eq(OvsdbDao.ovsdbName), Mockito.anyList());
|
||||||
|
Mockito.verify(apConfig, Mockito.times(3)).getApProfile();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetConnectNodeInfo() throws Exception {
|
public void testGetConnectNodeInfo() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user