@Test(expected = AmcIllegalArgumentException.class)
  public void testAddApplianceAlreadyExists() throws ApplianceConnectionException {
    logger.entry("\n\ntestAddApplianceAlreadyExists");

    Appliance applianceConnection = new Appliance();
    applianceConnection.name = "dp3";
    applianceConnection.hostName = "wamcdp3.hursley.ibm.com";
    applianceConnection.ampPort = 5550;
    applianceConnection.adminUserId = "admin";
    applianceConnection.adminUserPassword = "******";

    new TestWamtAppliance(manager, applianceConnection);

    logger.exit("testAddApplianceAlreadyExists");
  }
  @Test(expected = InvalidCredentialsException.class)
  public void testAddApplianceBadUsername() throws ApplianceConnectionException {
    logger.entry("\n\ntestAddApplianceBadUsername");

    Appliance applianceConnection = new Appliance();
    applianceConnection.name = "wamcdp5";
    applianceConnection.hostName = "wamcdp5.hursley.ibm.com";
    applianceConnection.ampPort = 5550;
    applianceConnection.adminUserId = "notright";
    applianceConnection.adminUserPassword = "******";

    new TestWamtAppliance(manager, applianceConnection);

    logger.exit("testAddApplianceBadUsername");
  }
  @Test(expected = ApplianceConnectionException.class)
  public void testAddApplianceBadConnectionDetails() throws ApplianceConnectionException {
    logger.entry("\n\ntestAddApplianceBadConnectionDetails");

    Appliance applianceConnection = new Appliance();
    applianceConnection.name = "wamcdp5";
    applianceConnection.hostName = "blurb";
    applianceConnection.ampPort = 5550;
    applianceConnection.adminUserId = "admin";
    applianceConnection.adminUserPassword = "******";

    new TestWamtAppliance(manager, applianceConnection);

    logger.exit("testAddApplianceBadConnectionDetails");
  }
  @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");
  }
  @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");
  }
  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");
  }