Search in sources :

Example 11 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestPluginService method testMSIListForIRODS420.

@Test
public void testMSIListForIRODS420() throws DataGridConnectionRefusedException, DataGridRuleException {
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(new ArrayList<>());
    when(irodsServices.isAtLeastIrods420()).thenReturn(true);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertFalse(server.isThereAnyMSI());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 12 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestPluginService method testMSIInstalledList.

@Test
public void testMSIInstalledList() throws DataGridConnectionRefusedException {
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    Map<String, Boolean> mlxMSIsMap = server.getMetalnxMSIs();
    Map<String, Boolean> iRODSMSIsMap = server.getIRODSMSIs();
    Map<String, Boolean> otherMSIsList = server.getOtherMSIs();
    for (String msi : irods41XMSIs) assertTrue(iRODSMSIsMap.containsKey(msi));
    for (String msi : mlxMSIList) assertTrue(mlxMSIsMap.containsKey(msi));
    for (String msi : otherMSIList) assertTrue(otherMSIsList.containsKey(msi));
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 13 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestServerUtil method testNullJsonResponse.

@Test
public void testNullJsonResponse() throws DataGridConnectionRefusedException {
    DataGridServer server = new DataGridServer();
    server.setHostname("icat.test.com");
    ServerUtil.populateDataGridServerStatus(null, server);
    assertEquals(server.getMachineStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getDataGridStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getDiskStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getMemoryStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 14 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestServerUtil method testEmptyJsonResponse.

@Test
public void testEmptyJsonResponse() throws DataGridConnectionRefusedException {
    DataGridServer server = new DataGridServer();
    server.setHostname("icat.test.com");
    ServerUtil.populateDataGridServerStatus("", server);
    assertEquals(server.getMachineStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getDataGridStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getDiskStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
    assertEquals(server.getMemoryStatus(), ServerRequestInfoType.WARNING_STATUS.toString());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 15 with DataGridServer

use of com.emc.metalnx.core.domain.entity.DataGridServer in project metalnx-web by irods-contrib.

the class TestMSIService method testNoOtherMSIInstalledFor41.

@Test
public void testNoOtherMSIInstalledFor41() throws DataGridConnectionRefusedException, DataGridRuleException {
    when(irodsServices.isAtLeastIrods420()).thenReturn(false);
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(new ArrayList<>());
    when(mockConfigService.getOtherMSIsExpected()).thenReturn(new ArrayList<>());
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertFalse(server.isThereAnyMSI());
    assertTrue(server.getOtherMSIs().isEmpty());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Aggregations

DataGridServer (com.emc.metalnx.core.domain.entity.DataGridServer)31 Test (org.junit.Test)12 DataGridResource (com.emc.metalnx.core.domain.entity.DataGridResource)7 ArrayList (java.util.ArrayList)5 Matchers.anyString (org.mockito.Matchers.anyString)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 DataGridMSIPkgInfo (com.emc.metalnx.core.domain.entity.DataGridMSIPkgInfo)2 DataGridConnectionRefusedException (com.emc.metalnx.core.domain.exceptions.DataGridConnectionRefusedException)2 DataGridServerStatusComparator (com.emc.metalnx.services.machine.util.DataGridServerStatusComparator)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 IOException (java.io.IOException)2 UnknownHostException (java.net.UnknownHostException)2 Before (org.junit.Before)2 ServerInformationRetrievalThread (com.emc.metalnx.services.machine.util.ServerInformationRetrievalThread)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1