public void testUpdateConnection() throws Exception { logger.entry("\n\ntestUpdateConnection"); Appliance applianceConnection = new Appliance(); applianceConnection.name = "wamcdp3"; applianceConnection.hostName = "wamcdp3.hursley.ibm.com"; applianceConnection.ampPort = 5550; applianceConnection.adminUserId = "admin"; applianceConnection.adminUserPassword = "******"; when(device.getSymbolicName()).thenReturn("wamcdp3"); WamtAppliance appliance = new TestWamtAppliance(manager, applianceConnection); Appliance updatedConnection = new Appliance(); updatedConnection.name = "wamcdp4"; updatedConnection.hostName = "wamcdp4.hursley.ibm.com"; updatedConnection.ampPort = 5551; updatedConnection.adminUserId = "admins"; updatedConnection.adminUserPassword = "******"; when(device.getSymbolicName()).thenReturn("wamcdp4"); appliance.updateConnection(updatedConnection); assertEquals("incorrect appliance name", "wamcdp4", appliance.getName()); assertEquals("incorrect host name", "wamcdp4.hursley.ibm.com", appliance.getHostname()); assertEquals("incorrect AMP port", "5551", appliance.getAmpPort()); assertEquals("incorrect user ID", "admins", appliance.getUserId()); logger.exit("testUpdateConnection"); }
@Test(expected = AmcIllegalArgumentException.class) public void testUpdateConnectionAlreadyExists() throws Exception { logger.entry("\n\ntestUpdateConnectionAlreadyExists"); Appliance applianceConnection = new Appliance(); applianceConnection.name = "wamcdp3"; applianceConnection.hostName = "wamcdp3.hursley.ibm.com"; applianceConnection.ampPort = 5550; applianceConnection.adminUserId = "admin"; applianceConnection.adminUserPassword = "******"; when(device.getSymbolicName()).thenReturn("wamcdp3"); WamtAppliance appliance = new TestWamtAppliance(manager, applianceConnection); Appliance updatedConnection = new Appliance(); updatedConnection.name = "wamcdp4"; updatedConnection.hostName = "wamcdp4.hursley.ibm.com"; updatedConnection.ampPort = 5551; updatedConnection.adminUserId = "admins"; updatedConnection.adminUserPassword = "******"; doThrow(new AlreadyExistsInRepositoryException()).when(device).setSymbolicName("wamcdp4"); appliance.updateConnection(updatedConnection); logger.exit("testUpdateConnectionAlreadyExists"); }
@Test public void testAddAppliance() throws Exception { logger.entry("\n\ntestAddAppliance"); Appliance applianceConnection = new Appliance(); applianceConnection.name = "wamcdp3"; applianceConnection.hostName = "wamcdp3.hursley.ibm.com"; applianceConnection.ampPort = 5550; applianceConnection.adminUserId = "admin"; applianceConnection.adminUserPassword = "******"; when(device.getSymbolicName()).thenReturn("wamcdp3"); WamtAppliance appliance = new TestWamtAppliance(manager, applianceConnection); assertEquals("incorrect appliance name", "wamcdp3", appliance.getName()); logger.exit("testAddAppliance"); }