Search in sources :

Example 16 with DataGridServer

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

the class TestMSIService method testGetMSIInstalledFor420Server.

@Test
public void testGetMSIInstalledFor420Server() throws DataGridConnectionRefusedException, DataGridRuleException {
    List<String> msis = new ArrayList<>(mlxMSIList);
    msis.addAll(irods42MSIs);
    msis.addAll(otherMSIList);
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(msis);
    when(irodsServices.isAtLeastIrods420()).thenReturn(true);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertTrue(server.isThereAnyMSI());
    assertMap(mlxMSIList, server.getMetalnxMSIs());
    assertMap(irods42MSIs, server.getIRODSMSIs());
    assertMap(otherMSIList, server.getOtherMSIs());
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 17 with DataGridServer

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

the class TestMSIService method testGetMSIInstalledFor41XServer.

@Test
public void testGetMSIInstalledFor41XServer() throws DataGridConnectionRefusedException, DataGridRuleException {
    List<String> msis = new ArrayList<>(mlxMSIList);
    msis.addAll(irods41XMSIs);
    msis.addAll(otherMSIList);
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(msis);
    when(irodsServices.isAtLeastIrods420()).thenReturn(false);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertTrue(server.isThereAnyMSI());
    assertMap(mlxMSIList, server.getMetalnxMSIs());
    assertMap(irods41XMSIs, server.getIRODSMSIs());
    assertMap(otherMSIList, server.getOtherMSIs());
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 18 with DataGridServer

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

the class TestMSIService method testOtherMSIInstalledFor420.

@Test
public void testOtherMSIInstalledFor420() throws DataGridConnectionRefusedException, DataGridRuleException {
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(otherMSIList);
    when(irodsServices.isAtLeastIrods420()).thenReturn(true);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertTrue(server.isThereAnyMSI());
    assertMap(otherMSIList, server.getOtherMSIs());
}
Also used : DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 19 with DataGridServer

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

the class TestMSIService method testNoOtherMSIListed.

@Test
public void testNoOtherMSIListed() throws DataGridConnectionRefusedException, DataGridRuleException {
    String testMSI = "libmsitest_installed.so";
    List<String> otherMSIListWithEmptyString = new ArrayList<>();
    otherMSIListWithEmptyString.add("");
    otherMSIListWithEmptyString.add(testMSI);
    when(irodsServices.isAtLeastIrods420()).thenReturn(false);
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(otherMSIListWithEmptyString);
    when(mockConfigService.getOtherMSIsExpected()).thenReturn(otherMSIListWithEmptyString);
    DataGridServer server = msiService.getMSIsInstalled("server1.test.com");
    assertTrue(server.isThereAnyMSI());
    assertFalse(server.getOtherMSIs().isEmpty());
    assertEquals(1, server.getOtherMSIs().size());
    assertTrue(server.getOtherMSIs().containsKey(testMSI));
}
Also used : ArrayList(java.util.ArrayList) Matchers.anyString(org.mockito.Matchers.anyString) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Test(org.junit.Test)

Example 20 with DataGridServer

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

the class TestMSIService method setUp.

@Before
public void setUp() throws JargonException, DataGridException {
    MockitoAnnotations.initMocks(this);
    DataGridServer s1 = new DataGridServer();
    s1.setHostname("server1.test.com");
    s1.setMSIVersion(msiVersion);
    s1.setIp("192.168.0.1");
    s1.setResources(new ArrayList<>());
    DataGridServer s2 = new DataGridServer();
    s2.setHostname("server2.test.com");
    s2.setMSIVersion(msiVersion);
    s2.setIp("192.168.0.2");
    s2.setResources(new ArrayList<>());
    servers.add(s1);
    servers.add(s2);
    when(mockResourceService.getAllResourceServers(anyListOf(DataGridResource.class))).thenReturn(servers);
    when(mockRuleService.execGetVersionRule(anyString())).thenReturn(msiVersion);
    when(mockRuleService.execGetMSIsRule(anyString())).thenReturn(msiList);
    when(mockConfigService.getMlxMSIsExpected()).thenReturn(mlxMSIList);
    when(mockConfigService.getIrods41MSIsExpected()).thenReturn(irods41XMSIs);
    when(mockConfigService.getIrods42MSIsExpected()).thenReturn(irods42MSIs);
    when(mockConfigService.getOtherMSIsExpected()).thenReturn(otherMSIList);
}
Also used : DataGridResource(com.emc.metalnx.core.domain.entity.DataGridResource) DataGridServer(com.emc.metalnx.core.domain.entity.DataGridServer) Before(org.junit.Before)

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