Package java.net

Examples of java.net.URI.resolve()


    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("server.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("services/fast.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("services/slow.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("orgo.gif")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("org/about.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("org/plans.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("%7Ejim/jim.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("%7Emak/mak.html")));
    // End of rfc test
  }
View Full Code Here


    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("services/fast.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("services/slow.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("orgo.gif")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("org/about.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("org/plans.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("%7Ejim/jim.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("%7Emak/mak.html")));
    // End of rfc test
  }

  @Test
View Full Code Here

    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("services/slow.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("orgo.gif")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("org/about.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("org/plans.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("%7Ejim/jim.html")));
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("%7Emak/mak.html")));
    // End of rfc test
  }

  @Test
  public void testRfcBadWebDesigner() throws Exception {
View Full Code Here

    URI target = BASE_URI.resolve("bad/");

    NoRobotClient nrc = new NoRobotClient("other");
    nrc.parse(target);

    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("%7Etest/%7Efoo.html")));
  }

  // Tests NRB-3
  // http://www.osjava.org:8080/jira/secure/ViewIssue.jspa?key=NRB-3
  @Test
View Full Code Here

  @Test
  public void testNrb3() throws Exception {
    URI target = BASE_URI.resolve("basic/");
    NoRobotClient nrc = new NoRobotClient("Scabies-1.0");
    nrc.parse(target);
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("basic")));
  }

  // Tests NRB-6
  // http://issues.osjava.org/jira/secure/ViewIssue.jspa?key=NRB-6
  @Test
View Full Code Here

  public void testNrb6() throws Exception {
    URI target = BASE_URI.resolve("order/");
    NoRobotClient nrc = new NoRobotClient("Scabies-1.0");
    nrc.parse(target);
    Assert.assertTrue("Specific then Wildcard not working as expected", nrc
        .isUrlAllowed(target.resolve("order/")));

    target = BASE_URI.resolve("order-reverse/");
    nrc = new NoRobotClient("Scabies-1.0");
    nrc.parse(target);
    Assert.assertTrue("Wildcard then Specific not working as expected", nrc
View Full Code Here

    target = BASE_URI.resolve("order-reverse/");
    nrc = new NoRobotClient("Scabies-1.0");
    nrc.parse(target);
    Assert.assertTrue("Wildcard then Specific not working as expected", nrc
        .isUrlAllowed(target.resolve("order/")));
  }     

  // Tests NRB-9
  // http://issues.osjava.org/jira/secure/ViewIssue.jspa?key=NRB-9
  @Test
View Full Code Here

  public void testNrb9() throws Exception {
    URI target = BASE_URI.resolve("disallow-empty/");
    NoRobotClient nrc = new NoRobotClient("test");
    nrc.parse(target);
    Assert.assertTrue("'Disallow: ' should mean to disallow nothing", nrc
        .isUrlAllowed(target.resolve("index.html")));
  }

  // Tests NRB-8
  // http://issues.osjava.org/jira/secure/ViewIssue.jspa?key=NRB-8
  @Test
View Full Code Here

    String[] names = new String[] {"test", "TEST", "tEsT"};
    for (int i = 0; i < names.length; i++) {
      NoRobotClient nrc = new NoRobotClient(names[i]);
      nrc.parse(target);
      Assert.assertFalse("User-Agent names should be case insensitive", nrc
          .isUrlAllowed(target.resolve("index.html")));
    }
  }

  @Test
  public void testRobotsParsing() throws Exception {
View Full Code Here

  @Test
  public void testAllowed() throws Exception {
    URI target = BASE_URI.resolve("basic/");
    NoRobotClient nrc = new NoRobotClient("Scabies-1.0");
    nrc.parse(target);
    Assert.assertTrue(nrc.isUrlAllowed(target.resolve("index.html")));
    Assert.assertFalse(nrc.isUrlAllowed(target.resolve("view-cvs/")));
  }

  // Tests the example given in the RFC
  @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.