@Test(
      groups = "wso2.greg",
      description = "Promote from Commencement to Creation to Development",
      dependsOnMethods = "testAddLcToService")
  public void testPromoteLC()
      throws RemoteException, CustomLifecyclesChecklistAdminServiceExceptionException,
          LifeCycleManagementServiceExceptionException, RegistryExceptionException {

    lifeCycleAdminServiceClient.invokeAspect(absPath, LC_NAME, ACTION_PROMOTE, null);
    lifeCycle = lifeCycleAdminServiceClient.getLifecycleBean(absPath);
    for (Property prop : lifeCycle.getLifecycleProperties()) {
      if (("registry.lifecycle." + LC_NAME + ".state").equalsIgnoreCase(prop.getKey())) {
        assertNotNull(prop.getValues(), "State Value Not Found");
        assertTrue(
            prop.getValues()[0].equalsIgnoreCase(LC_STATE1), "LifeCycle not promoted to Creation");
      }
    }
    lifeCycleAdminServiceClient.invokeAspect(absPath, LC_NAME, ACTION_PROMOTE, null);
    lifeCycle = lifeCycleAdminServiceClient.getLifecycleBean(absPath);
    for (Property prop : lifeCycle.getLifecycleProperties()) {
      if (("registry.lifecycle." + LC_NAME + ".state").equalsIgnoreCase(prop.getKey())) {
        assertNotNull(prop.getValues(), "State Value Not Found");
        assertTrue(
            prop.getValues()[0].equalsIgnoreCase(LC_STATE2),
            "LifeCycle not promoted to Development");
      }
    }
  }
  /** @throws Exception */
  @Test(
      groups = "wso2.greg",
      description = "Remove LC Transition Event Approval(Untick)",
      dependsOnMethods = "testSubscribeLCApprovalWithdrawnNotification")
  public void testLCTransitionApprovalWithDrawn() throws Exception {

    lifeCycleAdminServiceClient.invokeAspect(
        absPath, LC_NAME, ACTION_VOTE_CLICK, new String[] {"false", "false"});
    lifeCycle = lifeCycleAdminServiceClient.getLifecycleBean(absPath);
    for (Property prop : lifeCycle.getLifecycleApproval()) {
      if (prop.getKey().contains("registry.custom_lifecycle.votes.option")
          && !prop.getKey().contains("permission")) {
        for (String value : prop.getValues()) {
          if (value.startsWith("current")) {
            assertEquals(value, "current:0", "Not Approved");
          }
        }
      }
    }
  }
  /** @throws Exception */
  @Test(
      groups = "wso2.greg",
      description = "Add lifecycle to a service",
      dependsOnMethods = "testSubscribeLCApprovalNeededNotification")
  public void testAddLcToService() throws Exception {

    wsRegistryServiceClient.associateAspect(absPath, LC_NAME);
    lifeCycle = lifeCycleAdminServiceClient.getLifecycleBean(absPath);
    Property[] properties = lifeCycle.getLifecycleProperties();
    boolean lcStatus = false;
    for (Property prop : properties) {
      if (prop.getKey().contains(LC_NAME)) {
        lcStatus = true;
      }
    }
    assertTrue(lcStatus, "LifeCycle not added to service");
  }
  @Test(
      groups = "wso2.greg",
      description = "Add lifecycle to a service",
      dependsOnMethods = "testCreateNewLifeCycle")
  public void testAddLcToService()
      throws RegistryException, RemoteException,
          CustomLifecyclesChecklistAdminServiceExceptionException,
          ListMetadataServiceRegistryExceptionException, ResourceAdminServiceExceptionException {

    wsRegistryServiceClient.associateAspect(absPath, LC_NAME);
    lifeCycle = lifeCycleAdminServiceClient.getLifecycleBean(absPath);
    Property[] properties = lifeCycle.getLifecycleProperties();
    boolean lcStatus = false;
    for (Property prop : properties) {
      if (prop.getKey().contains(LC_NAME)) {
        lcStatus = true;
      }
    }
    assertTrue(lcStatus, "LifeCycle not added to service");
  }