Examples of ClasspathResourceLoader


Examples of com.asual.lesscss.loader.ClasspathResourceLoader

    this(options, defaultResourceLoader(options));
  }

  private static ResourceLoader defaultResourceLoader(LessOptions options) {
    ResourceLoader resourceLoader = new ChainedResourceLoader(
        new FilesystemResourceLoader(), new ClasspathResourceLoader(
            LessEngine.class.getClassLoader()),
        new HTTPResourceLoader());
    if(options.isCss()) {
      return new CssProcessingResourceLoader(resourceLoader);     
    }
View Full Code Here

Examples of net.sf.jportlet.util.ClasspathResourceLoader

        _descriptor          = proxy.getDescriptor(  );
        _application         = application;
        _servletContext      = servletContext;
        _log                 = new PortletLogImpl( Portlet.class.getName(  ) + ":" + proxy.getDescriptor(  ).getName(  ) );
        _webResourceLoader   = new WebResourceLoader( _descriptor.getContextPath(  ), servletContext );
        _classResourceLoader = new ClasspathResourceLoader( _descriptor.getPortletClass(  ) );
    }
View Full Code Here

Examples of net.sf.jportlet.util.ClasspathResourceLoader

  }
 
  public void testGetResourcePath() throws Exception
  {
    String xpath;
    ClasspathResourceLoader cp = new ClasspathResourceLoader(ClasspathResourceLoaderTest.class);
   
    xpath = cp.getResourcePath("res.txt");
    assertEquals( "net/sf/jportlet/util/test/res.txt", xpath);

    /* Markup */   
    xpath = cp.getResourcePath("res.html", Portlet.Markup.HTML.toString());
    assertEquals( "net/sf/jportlet/util/test/html/res.html", xpath);
     
    xpath = cp.getResourcePath("res.txt", Portlet.Markup.HTML.toString());
    assertEquals( "net/sf/jportlet/util/test/res.txt", xpath);
   
    /* Language */
    xpath = cp.getResourcePath("res.html", Portlet.Markup.HTML.toString(), Locale.ENGLISH);
    assertEquals( "net/sf/jportlet/util/test/html/res_en.html", xpath);
   
    xpath = cp.getResourcePath("res.txt", Portlet.Markup.HTML.toString(), Locale.ENGLISH);
    assertEquals( "net/sf/jportlet/util/test/res.txt", xpath);
   
    /* Locale */
    xpath = cp.getResourcePath("res.html", Portlet.Markup.HTML.toString(), Locale.US );
    assertEquals( "net/sf/jportlet/util/test/html/res_en_US.html", xpath);
   
    xpath = cp.getResourcePath("res.txt", Portlet.Markup.HTML.toString(), Locale.US);
    assertEquals( "net/sf/jportlet/util/test/res.txt", xpath);
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

   */
  public void testFactoryDefaults() throws IOException {
    Map<String,String> args = new HashMap<String,String>();
    args.put(PhoneticFilterFactory.ENCODER, "Metaphone");
    PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
    factory.inform(new ClasspathResourceLoader(factory.getClass()));
    assertTrue(factory.getEncoder() instanceof Metaphone);
    assertTrue(factory.inject); // default
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testInjectFalse() throws IOException {
    Map<String,String> args = new HashMap<String,String>();
    args.put(PhoneticFilterFactory.ENCODER, "Metaphone");
    args.put(PhoneticFilterFactory.INJECT, "false");
    PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
    factory.inform(new ClasspathResourceLoader(factory.getClass()));
    assertFalse(factory.inject);
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testMaxCodeLength() throws IOException {
    Map<String,String> args = new HashMap<String,String>();
    args.put(PhoneticFilterFactory.ENCODER, "Metaphone");
    args.put(PhoneticFilterFactory.MAX_CODE_LENGTH, "2");
    PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
    factory.inform(new ClasspathResourceLoader(factory.getClass()));
    assertEquals(2, ((Metaphone) factory.getEncoder()).getMaxCodeLen());
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testUnknownEncoder() throws IOException {
    try {
      Map<String,String> args = new HashMap<String,String>();
      args.put("encoder", "XXX");
      PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
      factory.inform(new ClasspathResourceLoader(factory.getClass()));
      fail();
    } catch (IllegalArgumentException expected) {
      assertTrue(expected.getMessage().contains("Error loading encoder"));
    }
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

  public void testUnknownEncoderReflection() throws IOException {
    try {
      Map<String,String> args = new HashMap<String,String>();
      args.put("encoder", "org.apache.commons.codec.language.NonExistence");
      PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
      factory.inform(new ClasspathResourceLoader(factory.getClass()));
      fail();
    } catch (IllegalArgumentException expected) {
      assertTrue(expected.getMessage().contains("Error loading encoder"));
    }
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

   */
  public void testFactoryReflection() throws IOException {
    Map<String,String> args = new HashMap<String, String>();
    args.put(PhoneticFilterFactory.ENCODER, "org.apache.commons.codec.language.Metaphone");
    PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
    factory.inform(new ClasspathResourceLoader(factory.getClass()));
    assertTrue(factory.getEncoder() instanceof Metaphone);
    assertTrue(factory.inject); // default
  }
View Full Code Here

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader

   */
  public void testFactoryReflectionCaverphone2() throws IOException {
    Map<String,String> args = new HashMap<String, String>();
    args.put(PhoneticFilterFactory.ENCODER, "Caverphone2");
    PhoneticFilterFactory factory = new PhoneticFilterFactory(args);
    factory.inform(new ClasspathResourceLoader(factory.getClass()));
    assertTrue(factory.getEncoder() instanceof Caverphone2);
    assertTrue(factory.inject); // default
  }
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.