コード例 #1
0
  @Test(
      groups = "wso2.greg",
      description = "Upload CApp as Service",
      dependsOnMethods = "cAppWithIncorrectServerRole")
  public void deployNewCApplication()
      throws MalformedURLException, RemoteException, ApplicationAdminExceptionException,
          InterruptedException, RegistryException, ResourceAdminServiceExceptionException,
          LogViewerLogViewerException {

    String resourcePath =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "car"
            + File.separator
            + "wsdl-t_1.0.0.car";

    cAppUploader.uploadCarbonAppArtifact(
        "wsdl-t_1.0.0.car", new DataHandler(new URL("file:///" + resourcePath)));

    assertTrue(
        CAppTestUtils.isCAppDeployed(sessionCookie, wsdl_tCapp, adminServiceApplicationAdmin),
        "Deployed wsdl-t_1.0.0.car not in CApp List");

    LogEvent[] logEvents =
        logViewerClient.getLogs(
            "INFO", "Successfully Deployed Carbon Application : wsdl-t", "", "");

    boolean status = false;
    for (LogEvent event : logEvents) {
      if (event.getMessage().contains("Successfully Deployed Carbon Application : wsdl-t")) {
        status = true;
        break;
      }
    }
    assertTrue(status, "Log info message for cApp deployment not found");

    boolean isService = false;

    //
    GovernanceUtils.loadGovernanceArtifacts((UserRegistry) governance);
    GenericArtifactManager manager = new GenericArtifactManager(governance, "service");

    GenericArtifact[] serviceArtifacts = manager.getAllGenericArtifacts();

    for (GenericArtifact genericArtifact : serviceArtifacts) {
      String name = genericArtifact.getQName().getLocalPart();
      if (name.equalsIgnoreCase("WeatherForecastService")) {
        isService = true;
        break;
      }
    }
    assertTrue(isService);
  }
コード例 #2
0
  @Test(
      groups = "wso2.greg",
      description = "Upload CApp with incorrect ServerRole(ESB)",
      dependsOnMethods = "deployCAppWithWsdl")
  public void cAppWithIncorrectServerRole()
      throws MalformedURLException, RemoteException, ApplicationAdminExceptionException,
          InterruptedException, LogViewerLogViewerException {

    String resourcePath =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "car"
            + File.separator
            + "serverRole-incorrect_1.0.0.car";

    cAppUploader.uploadCarbonAppArtifact(
        "serverRole-incorrect_1.0.0.car", new DataHandler(new URL("file:///" + resourcePath)));

    assertFalse(
        CAppTestUtils.isCAppDeployed(
            sessionCookie, serverRole_incorrectCapp, adminServiceApplicationAdmin),
        "Deployed serverRole-incorrect_1.0.0.car not in CApp List");

    LogEvent[] logEvents =
        logViewerClient.getLogs(
            "WARN",
            "No artifacts found to be deployed in this server."
                + " Ignoring Carbon Application : serverRole-incorrect_1.0.0.car",
            "",
            "");

    boolean status = false;
    for (LogEvent event : logEvents) {
      if (event
          .getMessage()
          .contains(
              "No artifacts found to be deployed in this server. "
                  + "Ignoring Carbon Application : serverRole-incorrect_1.0.0.car")) {
        status = true;
        break;
      }
    }
    assertTrue(status, "Log info message for capp deployment not found");
  }
コード例 #3
0
  @Test(groups = "wso2.greg", description = "Upload CApp with wsdls")
  public void deployCAppWithWsdl()
      throws MalformedURLException, RemoteException, ApplicationAdminExceptionException,
          InterruptedException, LogViewerLogViewerException {

    String resourcePath =
        FrameworkPathUtil.getSystemResourceLocation()
            + "artifacts"
            + File.separator
            + "GREG"
            + File.separator
            + "car"
            + File.separator
            + "wsdl_1.0.0.car";

    cAppUploader.uploadCarbonAppArtifact(
        "wsdl_1.0.0.car", new DataHandler(new URL("file:///" + resourcePath)));

    // artifact.xml  name is  "wsdl_new".
    assertTrue(
        CAppTestUtils.isCAppDeployed(sessionCookie, wsdl_new_1Capp, adminServiceApplicationAdmin),
        "Deployed wsdl_1.0.0.car not in CApp List");

    LogEvent[] logEvents =
        logViewerClient.getLogs(
            "INFO", "Successfully Deployed Carbon Application : wsdl_new", "", "");

    boolean status = false;
    for (LogEvent event : logEvents) {
      if (event.getMessage().contains("Successfully Deployed Carbon Application : wsdl_new")) {
        status = true;
        break;
      }
    }
    assertTrue(status, "Log info message for capp deployment not found");
  }