コード例 #1
0
  /**
   * This test require the dirty model, since the checkParams method would check there's a
   * GreTunnelService in the model.
   *
   * @throws CapabilityException
   * @throws ProtocolException
   */
  @Test
  @Ignore
  public void testDeleteUnexistingTunnelAction() throws CapabilityException, ProtocolException {
    log.info("TEST GRE TUNNEL ACTION");
    IGRETunnelCapability greCapability =
        (IGRETunnelCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(TestsConstants.GRE_CAPABILITY_TYPE));

    greCapability.deleteGRETunnel(
        ParamCreationHelper.getGRETunnelService(TUNNEL_NAME, null, null, null, null));

    IQueueManagerCapability queueCapability =
        (IQueueManagerCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(
                    TestsConstants.QUEUE_CAPABILIY_TYPE));

    List<IAction> queue = (List<IAction>) queueCapability.getActions();
    Assert.assertEquals(queue.size(), 1);

    QueueResponse queueResponse = (QueueResponse) queueCapability.execute();
    Assert.assertEquals(queueResponse.getResponses().size(), 1);

    Assert.assertFalse(queueResponse.isOk());

    queue = (List<IAction>) queueCapability.getActions();
    Assert.assertEquals(queue.size(), 0);
  }
コード例 #2
0
  @Test
  public void testGREDeleteTunnelAction() throws CapabilityException, ProtocolException {
    log.info("TEST GRE TUNNEL ACTION");
    IGRETunnelCapability greCapability =
        (IGRETunnelCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(TestsConstants.GRE_CAPABILITY_TYPE));

    // add gre tunnel service to the router model.
    GRETunnelService greTunnelService = new GRETunnelService();
    greTunnelService.setName(TUNNEL_NAME);

    ComputerSystem model = (ComputerSystem) routerResource.getModel();
    model.addHostedService(greTunnelService);
    routerResource.setModel(model);

    greCapability.deleteGRETunnel(
        ParamCreationHelper.getGRETunnelService(TUNNEL_NAME, null, null, null, null));

    IQueueManagerCapability queueCapability =
        (IQueueManagerCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(
                    TestsConstants.QUEUE_CAPABILIY_TYPE));

    List<IAction> queue = (List<IAction>) queueCapability.getActions();
    Assert.assertEquals(queue.size(), 1);

    QueueResponse queueResponse = (QueueResponse) queueCapability.execute();
    Assert.assertEquals(queueResponse.getResponses().size(), 1);

    Assert.assertEquals(queueResponse.getPrepareResponse().getStatus(), ActionResponse.STATUS.OK);
    Assert.assertEquals(queueResponse.getConfirmResponse().getStatus(), ActionResponse.STATUS.OK);
    Assert.assertEquals(queueResponse.getRefreshResponse().getStatus(), ActionResponse.STATUS.OK);
    Assert.assertEquals(
        queueResponse.getRestoreResponse().getStatus(), ActionResponse.STATUS.PENDING);

    Assert.assertTrue(queueResponse.isOk());

    queue = (List<IAction>) queueCapability.getActions();
    Assert.assertEquals(queue.size(), 0);
  }
コード例 #3
0
  @Test
  public void deleteGRETunnelTest() throws CapabilityException, ProtocolException {
    log.info("Test createGRETunnel method");

    IGRETunnelCapability greCapability =
        (IGRETunnelCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(TestsConstants.GRE_CAPABILITY_TYPE));

    greCapability.deleteGRETunnel(
        ParamCreationHelper.getGRETunnelService(TUNNEL_NAME, null, null, null, null));

    IQueueManagerCapability queueCapability =
        (IQueueManagerCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(
                    TestsConstants.QUEUE_CAPABILIY_TYPE));

    QueueResponse queueResponse = (QueueResponse) queueCapability.execute();

    Assert.assertTrue(queueResponse.isOk());
  }