Esempio n. 1
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());
    }
  }
Esempio n. 2
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);
    }
  }
 static SmlHost checkForSmlHostnameOverride(SmlHost smlHost) {
   String smlHostname = GlobalConfiguration.getInstance().getSmlHostname();
   if (!String.valueOf(smlHostname).isEmpty()) {
     log.debug("SML hostname has been overridden: [" + smlHostname + "]");
     smlHost = SmlHost.valueOf(smlHostname);
   }
   return smlHost;
 }
  /**
   * Discovers which SML host should be used.
   *
   * @return the SML host instance to be used
   */
  static SmlHost discoverSmlHost() {
    SmlHost smlHost;
    switch (GlobalConfiguration.getInstance().getModeOfOperation()) {
      case TEST:
        log.warn("Mode of operation is TEST");
        smlHost = SmlHost.TEST_SML;
        break;
      default:
        smlHost = SmlHost.PRODUCTION_SML;
        break;
    }

    // Finally we check to see if the SML hostname has been overridden in the configuration file
    smlHost = checkForSmlHostnameOverride(smlHost);

    log.debug("SML hostname: " + smlHost);
    return smlHost;
  }