Search in sources :

Example 1 with InfoBloxIPInfoResult

use of com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult in project flowgate by vmware.

the class InfobloxClientTest method getExpectedResult.

private List<InfoBloxIPInfoResult> getExpectedResult() {
    List<InfoBloxIPInfoResult> expectedResult = new ArrayList<>();
    InfoBloxIPInfoResult infoBloxIPInfoResult1 = new InfoBloxIPInfoResult();
    infoBloxIPInfoResult1.setIpAddress("10.161.71.154");
    infoBloxIPInfoResult1.setHostName("ubuntu01");
    infoBloxIPInfoResult1.setMacAddress("00:50:56:be:60:62");
    expectedResult.add(infoBloxIPInfoResult1);
    return expectedResult;
}
Also used : ArrayList(java.util.ArrayList) InfoBloxIPInfoResult(com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult)

Example 2 with InfoBloxIPInfoResult

use of com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult in project flowgate by vmware.

the class InfobloxClientTest method queryHostRecordByIPTestZoneIsNull.

@Test
public void queryHostRecordByIPTestZoneIsNull() {
    String ip = "10.161.71.154";
    List<InfoBloxIPInfoResult> expectedResult = this.getExpectedResult();
    InfobloxClient infobloxClient = new InfobloxClient(getInfobloxFacilitySoftware()[0]);
    infobloxClient = Mockito.spy(infobloxClient);
    Mockito.doReturn(this.getJsonResultForQueryHostRecordZoneIsNull()).when(infobloxClient).getHostRecord(ip);
    List<InfoBloxIPInfoResult> actualResult = infobloxClient.queryHostRecordByIP(ip);
    TestCase.assertEquals(expectedResult.size(), actualResult.size());
    for (int i = 0; i < expectedResult.size(); i++) {
        TestCase.assertEquals(expectedResult.get(i).getIpAddress(), actualResult.get(i).getIpAddress());
        TestCase.assertEquals(expectedResult.get(i).getHostName(), actualResult.get(i).getHostName());
        TestCase.assertEquals(expectedResult.get(i).getMacAddress(), actualResult.get(i).getMacAddress());
    }
}
Also used : InfobloxClient(com.vmware.flowgate.infobloxworker.service.InfobloxClient) InfoBloxIPInfoResult(com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with InfoBloxIPInfoResult

use of com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult in project flowgate by vmware.

the class InfobloxServiceTest method getInfoBloxIPInfoResults.

private List<InfoBloxIPInfoResult> getInfoBloxIPInfoResults() {
    List<InfoBloxIPInfoResult> expectedResult = new ArrayList<>();
    InfoBloxIPInfoResult infoBloxIPInfoResult1 = new InfoBloxIPInfoResult();
    infoBloxIPInfoResult1.setIpAddress("10.161.71.154");
    infoBloxIPInfoResult1.setHostName("ubuntu01");
    infoBloxIPInfoResult1.setMacAddress("00:50:56:be:60:62");
    expectedResult.add(infoBloxIPInfoResult1);
    return expectedResult;
}
Also used : ArrayList(java.util.ArrayList) InfoBloxIPInfoResult(com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult)

Example 4 with InfoBloxIPInfoResult

use of com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult in project flowgate by vmware.

the class InfobloxClientTest method queryHostRecordByIPTestZoneNonNull.

@Test
public void queryHostRecordByIPTestZoneNonNull() {
    String ip = "10.161.71.154";
    List<InfoBloxIPInfoResult> expectedResult = this.getExpectedResult();
    InfobloxClient infobloxClient = new InfobloxClient(getInfobloxFacilitySoftware()[0]);
    infobloxClient = Mockito.spy(infobloxClient);
    Mockito.doReturn(this.getJsonResultForQueryHostRecordZoneNonNull()).when(infobloxClient).getHostRecord(ip);
    List<InfoBloxIPInfoResult> actualResult = infobloxClient.queryHostRecordByIP(ip);
    TestCase.assertEquals(expectedResult.size(), actualResult.size());
    for (int i = 0; i < expectedResult.size(); i++) {
        TestCase.assertEquals(expectedResult.get(i).getIpAddress(), actualResult.get(i).getIpAddress());
        TestCase.assertEquals(expectedResult.get(i).getHostName(), actualResult.get(i).getHostName());
        TestCase.assertEquals(expectedResult.get(i).getMacAddress(), actualResult.get(i).getMacAddress());
    }
}
Also used : InfobloxClient(com.vmware.flowgate.infobloxworker.service.InfobloxClient) InfoBloxIPInfoResult(com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 5 with InfoBloxIPInfoResult

use of com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult in project flowgate by vmware.

the class InfobloxClientTest method queryHostNamesByIPTestZoneIsNull.

@Test
public void queryHostNamesByIPTestZoneIsNull() {
    String ip = "10.161.71.154";
    List<InfoBloxIPInfoResult> expectedResult = this.getExpectedResult();
    InfobloxClient infobloxClient = new InfobloxClient(getInfobloxFacilitySoftware()[0]);
    infobloxClient = Mockito.spy(infobloxClient);
    Mockito.doReturn(this.getJsonResultForQueryHostNamesZoneIsNull()).when(infobloxClient).getIpv4address(ip);
    List<InfoBloxIPInfoResult> actualResult = infobloxClient.queryIpv4addressByIP(ip);
    TestCase.assertEquals(expectedResult.size(), actualResult.size());
    for (int i = 0; i < expectedResult.size(); i++) {
        TestCase.assertEquals(expectedResult.get(i).getIpAddress(), actualResult.get(i).getIpAddress());
        TestCase.assertEquals(expectedResult.get(i).getHostName(), actualResult.get(i).getHostName());
        TestCase.assertEquals(expectedResult.get(i).getMacAddress(), actualResult.get(i).getMacAddress());
    }
}
Also used : InfobloxClient(com.vmware.flowgate.infobloxworker.service.InfobloxClient) InfoBloxIPInfoResult(com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

InfoBloxIPInfoResult (com.vmware.flowgate.infobloxworker.model.InfoBloxIPInfoResult)7 InfobloxClient (com.vmware.flowgate.infobloxworker.service.InfobloxClient)5 Test (org.junit.Test)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ArrayList (java.util.ArrayList)3 Asset (com.vmware.flowgate.common.model.Asset)1 AssetIPMapping (com.vmware.flowgate.common.model.AssetIPMapping)1 FacilitySoftwareConfig (com.vmware.flowgate.common.model.FacilitySoftwareConfig)1 IntegrationStatus (com.vmware.flowgate.common.model.IntegrationStatus)1 ConnectException (java.net.ConnectException)1 Async (org.springframework.scheduling.annotation.Async)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1 ResourceAccessException (org.springframework.web.client.ResourceAccessException)1