コード例 #1
0
 @After
 public void tearDown() {
   pse.tearDown();
   pss.tearDown();
   mtf.tearDown();
   JMSConnectionFactory.getInstance().removeListener(Channels.getTheIndexServer(), listener);
   mjms.tearDown();
   rs.tearDown();
 }
コード例 #2
0
 @After
 public void tearDown() {
   marc.tearDown();
   pse.tearDown();
   pss.tearDown();
   mtf.tearDown();
   mjms.tearDown();
   ulrf.tearDown();
   RememberNotifications.resetSingleton();
   rs.tearDown();
 }
コード例 #3
0
 @Before
 public void setUp() {
   rs.setUp();
   ulrf.setUp();
   mjms.setUp();
   mtf.setUp();
   pss.setUp();
   pse.setUp();
   marc.setUp();
   Settings.set(CommonSettings.NOTIFICATIONS_CLASS, RememberNotifications.class.getName());
 }
コード例 #4
0
 @Before
 public void setUp() {
   rs.setUp();
   mjms.setUp();
   listener = new CreateIndexListener();
   JMSConnectionFactory.getInstance().setListener(Channels.getTheIndexServer(), listener);
   Settings.set(
       CommonSettings.REMOTE_FILE_CLASS, "dk.netarkivet.common.distribute.NullRemoteFile");
   Settings.set(CommonSettings.CACHE_DIR, TestInfo.CACHE_DIR.getPath());
   mtf.setUp();
   pss.setUp();
   pse.setUp();
 }
コード例 #5
0
  @Test
  public void testBadArguments4() {
    String[] args = new String[] {"-tMYINDEX", "-l1"};
    String expectedMsg = "Unknown indextype 'MYINDEX' requested.";

    try {
      CreateIndex.main(args);
      fail("It should not be allowed to call CreateIndex with bad arguments");
    } catch (SecurityException e) {
      // expected
    }

    String errMsg = pss.getErr();
    int exitCode = pse.getExitValue();

    assertEquals("Should have exit code 1, but was: " + exitCode, 1, exitCode);
    assertTrue(
        "The error message should contain '" + expectedMsg + "', but saw '" + errMsg + "'.",
        errMsg.contains(expectedMsg));
  }
コード例 #6
0
  @Test
  public void testBadArguments1() {
    String[] args = new String[] {"-asdf"};
    String expectedMsg = "Parsing of parameters failed: Unrecognized option: -a";

    try {
      CreateIndex.main(args);
      fail("It should not be allowed to call CreateIndex with bad arguments");
    } catch (SecurityException e) {
      // expected
    }

    String errMsg = pss.getErr();
    int exitCode = pse.getExitValue();

    assertEquals("Should have exit code 1, but was: " + exitCode, 1, exitCode);
    assertTrue(
        "The error message should contain '" + expectedMsg + "', but saw '" + errMsg + "'.",
        errMsg.contains(expectedMsg));
  }
コード例 #7
0
  @Test
  public void testBadArguments3() {
    String[] args = new String[] {"-l1"};
    // String expectedMsg =
    // "Some of the required parameters are missing: -t";
    String expectedMsg = "Some of the required parameters are missing: Missing required option: t";

    try {
      CreateIndex.main(args);
      fail("It should not be allowed to call CreateIndex with bad arguments");
    } catch (SecurityException e) {
      // expected
    }

    String errMsg = pss.getErr();
    int exitCode = pse.getExitValue();

    assertEquals("Should have exit code 1, but was: " + exitCode, 1, exitCode);
    assertTrue(
        "The error message should contain '" + expectedMsg + "', but saw '" + errMsg + "'.",
        errMsg.contains(expectedMsg));
  }