Exemplo n.º 1
0
  /**
   * Main method test of single update for IP deployment time example
   *
   * @param url Database JDBC URL to connect with
   * @param username Database username
   * @param password Database password
   * @param providerId ID of example provider
   * @param serviceId ID of example service
   * @throws InitialisationException thrown on failure to initialise class due to invalid input
   *     parameters
   */
  private static void singleUpdateIpDeployment(
      String url, String username, String password, String providerId, String serviceId)
      throws InitialisationException {

    // The risk value to set in this example
    final double riskValue = 1.0;

    // GRAPHTYPE_IP_DEPLOYMENT_SLA_RISKLEVEL
    RiskPropagator riskPropagator =
        new RiskPropagator(
            url,
            username,
            password,
            RiskPropagator.PROVIDERTYPE_IP,
            RiskPropagator.SERVICEPHASE_DEPLOYMENT,
            providerId,
            serviceId,
            RiskPropagator.GRAPHTYPE_IP_DEPLOYMENT_SLA_RISKLEVEL);
    riskPropagator.setRiskValue(riskValue);
    riskPropagator.addRiskValue();
  }
Exemplo n.º 2
0
  /**
   * Main method test of single update for SP deployment time example
   *
   * @param url Database JDBC URL to connect with
   * @param username Database username
   * @param password Database password
   * @param providerIdOne ID of first example provider
   * @param serviceIdOne ID of first example service
   * @param providerIdTwo ID of second example provider
   * @param serviceIdTwo ID of second example service
   * @throws InitialisationException thrown on failure to initialise class due to invalid input
   *     parameters
   */
  private static void singleUpdateSpDeployment(
      String url,
      String username,
      String password,
      String providerIdOne,
      String serviceIdOne,
      String providerIdTwo,
      String serviceIdTwo)
      throws InitialisationException {

    // The risk value to set in this example
    final double riskValue = 1.0;

    // Test with an EXISTING provider and service ID
    // GRAPHTYPE_SP_DEPLOYMENT_RELATIVE_IP_SLA_RISKLEVEL
    RiskPropagator riskPropagator;
    riskPropagator =
        new RiskPropagator(
            url,
            username,
            password,
            RiskPropagator.PROVIDERTYPE_SP,
            RiskPropagator.SERVICEPHASE_DEPLOYMENT,
            // Test with an existing provider ID
            providerIdOne,
            // Test with an existing service ID
            serviceIdOne,
            RiskPropagator.GRAPHTYPE_SP_DEPLOYMENT_RELATIVE_IP_SLA_RISKLEVEL);
    // Set the value we want to save
    riskPropagator.setRiskValue(riskValue);
    // Commit the value to the database
    riskPropagator.addRiskValue();

    // Test with an NON-EXISTENT provider and service ID
    // GRAPHTYPE_SP_DEPLOYMENT_RELATIVE_IP_SLA_RISKLEVEL
    riskPropagator =
        new RiskPropagator(
            url,
            username,
            password,
            RiskPropagator.PROVIDERTYPE_SP,
            RiskPropagator.SERVICEPHASE_DEPLOYMENT,
            // Test with an non-existent provider ID
            providerIdTwo,
            // Test with an non-existent service ID
            serviceIdTwo,
            RiskPropagator.GRAPHTYPE_SP_DEPLOYMENT_RELATIVE_IP_SLA_RISKLEVEL);
    // Set the value we want to save
    riskPropagator.setRiskValue(riskValue);
    // Commit the value to the database
    riskPropagator.addRiskValue();

    // GRAPHTYPE_SP_DEPLOYMENT_NORMALISED_SLA_RISKLEVEL
    riskPropagator =
        new RiskPropagator(
            url,
            username,
            password,
            RiskPropagator.PROVIDERTYPE_SP,
            RiskPropagator.SERVICEPHASE_DEPLOYMENT,
            providerIdTwo,
            serviceIdTwo,
            RiskPropagator.GRAPHTYPE_SP_DEPLOYMENT_NORMALISED_SLA_RISKLEVEL);

    riskPropagator.setRiskValue(riskValue);
    riskPropagator.addRiskValue();
  }