Beispiel #1
0
  public void searchContent() {
    SearchResultsBean bean = null;

    try {
      boolean searchSuccess = false;
      // Retrying until test passes
      log.info("### Content search retry cycle started .. ");
      for (int i = 0; i < RERTY_CYCLES; i++) {
        log.info("#### Content search cycle # " + i);
        bean =
            contentSearchAdminServiceStub.getContentSearchResults(
                "ArrayOftCountrySelectedTopScorer");
        if (bean.getResourceDataList() != null) {
          bean.setResourceDataList(new ResourceData[0]);
          searchSuccess = true;
          log.info("#### Content search PASSED .. in seconds : " + i * 15);
          break;

        } else {
          doSleep();
        }
      }
      if (!searchSuccess) {
        fail("# MetaData search test failed .. ");
        log.info("# MetaData search test failed .. ");
        log.error("# MetaData search test failed .. ");
      }

    } catch (Exception e) {
      fail("Content search failed: " + e);
      log.error("Content search failed: " + e.getMessage());
      String msg = "Failed to get search results from the search service. " + e.getMessage();
      log.error(msg, e);
    }
  }
  @Override
  @Test
  public void testMaxTotalConnectionsException() {
    AsyncHttpClient client =
        getAsyncHttpClient(
            new AsyncHttpClientConfig.Builder()
                .setAllowPoolingConnection(true)
                .setMaximumConnectionsTotal(1)
                .build());

    String url = getTargetUrl();
    int i;
    Exception exception = null;
    for (i = 0; i < 20; i++) {
      try {
        log.info("{} requesting url [{}]...", i, url);

        if (i < 5) {
          client.prepareGet(url).execute().get();
        } else {
          client.prepareGet(url).execute();
        }
      } catch (Exception ex) {
        exception = ex;
        break;
      }
    }
    assertNotNull(exception);
    assertNotNull(exception.getMessage());
  }
Beispiel #3
0
  @Test(enabled = false)
  public void sendToEspapTest() throws URISyntaxException {

    OperationalMode modeOfOperation = globalConfiguration.getModeOfOperation();
    assertEquals(modeOfOperation, OperationalMode.TEST, "This test may only be run in TEST mode");

    URL resource = MainIT.class.getClassLoader().getResource("BII04_T10_EHF-v2.0_invoice.xml");
    URI uri = resource.toURI();
    File testFile = new File(uri);
    assertTrue(testFile.canRead(), "Can not locate " + testFile);

    String[] args = {
      "-f", testFile.toString(),
      "-r", "9946:ESPAP",
      "-s", WellKnownParticipant.DIFI_TEST.toString(),
      "-t", "true",
      "-u", "https://ap1.espap.pt/oxalis/as2",
      "-m", "AS2",
      "-i", "APP_1000000222"
    };

    // Executes the outbound message sender
    try {
      Main.main(args);
    } catch (Exception e) {
      fail("Failed " + e.getMessage());
    }
  }
Beispiel #4
0
  @Test(enabled = true)
  public void sendToDifiTest() throws URISyntaxException {

    OperationalMode modeOfOperation = globalConfiguration.getModeOfOperation();
    assertEquals(modeOfOperation, OperationalMode.TEST, "This test may only be run in TEST mode");

    URL resource = MainIT.class.getClassLoader().getResource("BII04_T10_EHF-v2.0_invoice.xml");
    URI uri = resource.toURI();
    File testFile = new File(uri);
    assertTrue(testFile.canRead(), "Can not locate " + testFile);

    String[] args = {
      "-f", testFile.toString(),
      "-r", WellKnownParticipant.DIFI_TEST.toString(),
      "-s", WellKnownParticipant.U4_TEST.toString(),
      "-t", "true",
      "-e", "/tmp" // current directory
    };

    // Executes the outbound message sender
    try {
      Main.main(args);
    } catch (Exception e) {
      fail("Failed " + e.getMessage(), e);
    }
  }
 /**
  * Invalid conversion cases for COMPOUND to: BOOL, TEXT, INT, LONG, DECIMAL, XREF, CATEGORICAL,
  * EMAIL, HYPERLINK, HTML, ENUM, DATE, DATE_TIME, MREF, CATEGORICAL_MREF, FILE, ONE_TO_MANY
  *
  * @param valueToConvert The value that will be converted
  * @param typeToConvertTo The type to convert to
  * @param exceptionClass The expected class of the exception that will be thrown
  * @param exceptionMessage The expected exception message
  */
 @Test(dataProvider = "invalidConversionTestCases")
 public void testInvalidConversion(
     String valueToConvert,
     AttributeType typeToConvertTo,
     Class exceptionClass,
     String exceptionMessage) {
   try {
     testTypeConversion(valueToConvert, typeToConvertTo);
     fail("Conversion should have failed");
   } catch (Exception exception) {
     assertTrue(exception.getClass().isAssignableFrom(exceptionClass));
     assertEquals(exception.getMessage(), exceptionMessage);
   }
 }
 /**
  * Test show persistent result set.
  *
  * @param qCom the q com
  * @throws Exception the exception
  */
 private void testShowPersistentResultSet(LensQueryCommands qCom) throws Exception {
   System.out.println("@@PERSISTENT_RESULT_TEST-------------");
   client.setConnectionParam("lens.query.enable.persistent.resultset.indriver", "true");
   String query = "cube select id,name from test_dim";
   try {
     String result = qCom.executeQuery(query, false, "testQuery3");
     System.out.println("@@ RESULT " + result);
     assertNotNull(result);
     assertFalse(result.contains("Failed to get resultset"));
   } catch (Exception exc) {
     log.error("Exception not expected while getting resultset.", exc);
     fail("Exception not expected: " + exc.getMessage());
   }
   System.out.println("@@END_PERSISTENT_RESULT_TEST-------------");
 }
Beispiel #7
0
  public void addResource() {

    try {
      String resource =
          frameworkPath
              + File.separator
              + ".."
              + File.separator
              + ".."
              + File.separator
              + ".."
              + File.separator
              + "src"
              + File.separator
              + "test"
              + File.separator
              + "java"
              + File.separator
              + "resources"
              + File.separator
              + resourceName;

      resourceAdminServiceStub.addResource(
          wsdlPath + resourceName,
          "application/wsdl+xml",
          "test resource",
          new DataHandler(new URL("file:///" + resource)),
          null,
          null);

    } catch (Exception e) {
      fail("Unable to get file content: " + e);
      log.error("Unable to get file content: " + e.getMessage());
    }

    try {
      Thread.sleep(15000);
    } catch (InterruptedException e) {
    }
  }
  /**
   * Test purged finished result set.
   *
   * @param qCom the q com
   */
  private void testPurgedFinishedResultSet(LensQueryCommands qCom) {
    System.out.println("@@START_FINISHED_PURGED_RESULT_TEST-------------");
    client.setConnectionParam("lens.server.max.finished.queries", "0");
    client.setConnectionParam("lens.query.enable.persistent.resultset", "true");
    String query = "cube select id,name from test_dim";
    try {
      String qh = qCom.executeQuery(query, true, "testQuery");
      while (!client.getQueryStatus(qh).finished()) {
        Thread.sleep(5000);
      }
      assertTrue(qCom.getStatus(qh).contains("Status : SUCCESSFUL"));

      String result = qCom.getQueryResults(qh, null, true);
      System.out.println("@@ RESULT " + result);
      assertNotNull(result);

      // This is to check for positive processing time
      assertFalse(result.contains("(-"));
    } catch (Exception exc) {
      log.error("Exception not expected while purging resultset.", exc);
      fail("Exception not expected: " + exc.getMessage());
    }
    System.out.println("@@END_FINISHED_PURGED_RESULT_TEST-------------");
  }