public void testPostProcessInvalidSession() {
    String[] args = {"12312312xFFFFFABABABFFFCD01"};

    lip.before(new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));
    Object rc =
        lip.after(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer),
            "returnthis");
    assertEquals("returnthis", rc);
    assertEquals("", writer.toString());
  }
  public void testPreProcessWithInvalidSession() {
    String[] args = {"12312312xFFFFFABABABFFFCD01"};

    boolean rc =
        lip.before(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));
    assertTrue(rc);
  }
  public void testPreProcessWithXmlArg() {
    String[] args = {"<?xml version=\"1.0\"?><somestuff>foo</somestuff>", "password"};

    boolean rc =
        lip.before(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));

    assertTrue(rc);
  }
  public void testPreProcess() {
    String[] args = {"username", "password"};

    boolean rc =
        lip.before(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));

    assertTrue(rc);
  }
  public void testPostProcessValidSession() {
    User user = UserTestUtils.findNewUser("testUser", "testOrg");
    // create a web session indicating a logged in user.
    WebSession s = WebSessionFactory.createSession();
    s.setWebUserId(user.getId());
    assertNotNull(s);
    WebSessionFactory.save(s);
    assertNotNull(s.getId());

    String[] args = {s.getKey()};

    lip.before(new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));
    Object rc =
        lip.after(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer),
            "returnthis");
    assertEquals("returnthis", rc);
    assertEquals("", writer.toString());
  }
  public void testPostProcess() {
    String[] args = {"<?xml version=\"1.0\"?><somestuff>foo</somestuff>", "password"};

    Object rc =
        lip.after(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer),
            "returnthis");
    assertEquals("returnthis", rc);
    assertEquals("", writer.toString());
  }
  public void testAuthLogin() {
    String[] args = {"user", "password"};

    Object rc =
        lip.after(
            new XmlRpcInvocation(10, "auth", "login", null, Arrays.asList(args), writer),
            "returnthis");
    assertEquals("returnthis", rc);
    assertEquals("", writer.toString());
  }
  public void testPostProcessWhereFirstArgHasNoX() {
    String[] args = {"abcdefghijklmnopqrstuvwyz", "password"};

    Object rc =
        lip.after(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer),
            "returnthis");
    assertEquals("returnthis", rc);
    assertEquals("", writer.toString());
  }
  public void testPreProcessWithValidSession() {
    // create a web session indicating a logged in user.
    WebSession s = WebSessionFactory.createSession();
    assertNotNull(s);
    WebSessionFactory.save(s);
    assertNotNull(s.getId());

    String[] args = {s.getKey()};

    boolean rc =
        lip.before(
            new XmlRpcInvocation(10, "handler", "method", null, Arrays.asList(args), writer));

    assertTrue(rc);
  }