コード例 #1
0
  @BeforeClass(alwaysRun = true)
  public void configureServer() throws Exception {
    super.init();
    String carbonHome = ServerConfigurationManager.getCarbonHome();
    userMgtServerFile =
        new File(
            carbonHome
                + File.separator
                + "repository"
                + File.separator
                + "conf"
                + File.separator
                + "user-mgt.xml");
    File userMgtConfigFile =
        new File(
            getISResourceLocation()
                + File.separator
                + "userMgt"
                + File.separator
                + "JdbcUserMgtConfig.xml");

    scm = new ServerConfigurationManager(automationContext);
    scm.applyConfiguration(userMgtConfigFile, userMgtServerFile, true, true);
    doInit();
  }
コード例 #2
0
  /**
   * Cleanup all Analytics Tables and restart the server to clean in memory events.
   *
   * @param maxWaitTime Maximum time in seconds, to wait polling to check if the tables are
   *     cleaned-up.
   * @throws Exception
   * @throws AnalyticsException
   */
  protected void restartAndCleanUpTables(int maxWaitTime) throws Exception {
    long startTime = System.currentTimeMillis();
    // first restart the server to clear any in memory events and to clear timebatchWindows
    log.info("Restarting server..");
    ServerConfigurationManager serverManager = new ServerConfigurationManager(dasServer);
    serverManager.restartGracefully();
    ClientConnectionUtil.waitForLogin(dasServer);
    log.info("Restarting complete.");

    String[] tables =
        new String[] {
          TestConstants.ESB_EVENTS_TABLE,
          TestConstants.ESB_STAT_PER_SECOND_TABLE,
          TestConstants.ESB_STAT_PER_SECOND_ALL_TABLE,
          TestConstants.ESB_STAT_PER_MINUTE_TABLE,
          TestConstants.ESB_STAT_PER_MINUTE_ALL_TABLE,
          TestConstants.ESB_STAT_PER_HOUR_TABLE,
          TestConstants.ESB_STAT_PER_DAY_TABLE,
          TestConstants.ESB_STAT_PER_MONTH_TABLE,
          TestConstants.MEDIATOR_STAT_PER_SECOND_TABLE,
          TestConstants.MEDIATOR_STAT_PER_MINUTE_TABLE,
          TestConstants.MEDIATOR_STAT_PER_HOUR_TABLE,
          TestConstants.MEDIATOR_STAT_PER_DAY_TABLE,
          TestConstants.MEDIATOR_STAT_PER_MONTH_TABLE
        };
    long currentTime = System.currentTimeMillis();
    while ((currentTime - startTime) < maxWaitTime) {
      boolean isCleaned = true;
      for (String table : tables) {
        int recordsCount = 0;
        try {
          recordsCount = this.analyticsDataAPI.searchCount(-1234, table, "*:*");
        } catch (Exception ignoredException) {
        }
        if (recordsCount > 0) {
          isCleaned = false;
          try {
            this.analyticsDataAPI.delete(-1234, table, Long.MIN_VALUE, Long.MAX_VALUE);
          } catch (Exception ignoredException) {
          }
        }
      }
      if (isCleaned) {
        break;
      }
      Thread.sleep(5000);
      currentTime = System.currentTimeMillis();
    }
  }
コード例 #3
0
 @AfterClass(alwaysRun = true)
 public void restoreServer() throws Exception {
   try {
     super.clean();
   } finally {
     scm.restoreToLastConfiguration();
   }
 }
コード例 #4
0
 @AfterClass(alwaysRun = true)
 public void close() throws Exception {
   try {
     if (isProxyDeployed) {
       deleteProxyService("SmooksProxy");
     }
     resourceAdminServiceClient.deleteResource("/_system/config/smooks_config.xml");
   } finally {
     cleanup();
     Thread.sleep(3000);
     serverConfigurationManager.restoreToLastConfiguration();
     resourceAdminServiceClient = null;
     serverConfigurationManager = null;
   }
 }
コード例 #5
0
  @BeforeClass(alwaysRun = true)
  public void setEnvironment() throws Exception {

    super.init();
    serverConfigurationManager = new ServerConfigurationManager(context);
    serverConfigurationManager.applyConfiguration(
        new File(
            getClass()
                .getResource(
                    File.separator
                        + "artifacts"
                        + File.separator
                        + "ESB"
                        + File.separator
                        + "synapseconfig"
                        + File.separator
                        + "smooks"
                        + File.separator
                        + "axis2.xml")
                .getPath()));
    super.init();
    loadESBConfigurationFromClasspath(
        File.separator
            + "artifacts"
            + File.separator
            + "ESB"
            + File.separator
            + "synapseconfig"
            + File.separator
            + "smooks"
            + File.separator
            + "smooks_synapse.xml");

    resourceAdminServiceClient =
        new ResourceAdminServiceClient(
            contextUrls.getBackEndUrl(),
            context.getContextTenant().getContextUser().getUserName(),
            context.getContextTenant().getContextUser().getPassword());

    uploadResourcesToConfigRegistry();
    addSmooksProxy();
    addSmooksSequence();
  }