Package com.codingcrayons.aspectfaces

Examples of com.codingcrayons.aspectfaces.AFWeaver


    SimpleCache afCache = new SimpleCache();
    AFWeaver.setDefaultCacheProvider(afCache);

    AFWeaver.addStaticConfiguration(getConfig(CONFIG));
    AFWeaver afWeaver = new AFWeaver(CONFIG, new JavaInspector(Administrator.class));

    Context context = new Context(Administrator.class.getName(), null, null, null, false);

    String fragment = afWeaver.generate(context, keyA);
    assertEquals(afCache.get(keyA), fragment);
    fragment = afWeaver.generate(context, keyA);
    assertEquals(afCache.get(keyA), fragment);

    fragment = afWeaver.generate(context, new Settings(), keyB);
    assertEquals(afCache.get(keyB), fragment);
    fragment = afWeaver.generate(context, new Settings(), keyB);
    assertEquals(afCache.get(keyB), fragment);

    fragment = afWeaver.generate(context, regionA, keyAregA);
    assertEquals(afCache.get(regionA, keyAregA), fragment);
    fragment = afWeaver.generate(context, regionA, keyAregA);
    assertEquals(afCache.get(regionA, keyAregA), fragment);

    fragment = afWeaver.generate(context, new Settings(), regionB, keyAregB);
    assertEquals(afCache.get(regionB, keyAregB), fragment);
    fragment = afWeaver.generate(context, new Settings(), regionB, keyAregB);
    assertEquals(afCache.get(regionB, keyAregB), fragment);
  }
View Full Code Here


  @Test(expectedExceptions = CacheProviderNotSetException.class)
  public void testCacheIntegrationFail() throws AFException {
    Context context = new Context(Administrator.class.getName(), null, null, null, true);
    AFWeaver.addStaticConfiguration(getConfig(CONFIG));
    AFWeaver.setDefaultCacheProvider(null);
    AFWeaver afWeaver = new AFWeaver(CONFIG);
    afWeaver.generate(context, keyA);
  }
View Full Code Here

  @Test()
  public void testPermanentIgnoringAnnotations() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_EMPTY_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(emptyConfigurationName));
    afWeaver = new AFWeaver(emptyConfigurationName, new JavaInspector(Administrator.class));

    Configuration configuration = afWeaver.getConfiguration();
    Set<String> ignoringAnnotations = configuration.getIgnoringAnnotations();

    assertEquals(ignoringAnnotations.size(), 1);
View Full Code Here

  @Test()
  public void testClearedPermanentIgnoringAnnotations() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(noItemConfigurationName));
    afWeaver = new AFWeaver(noItemConfigurationName, new JavaInspector(Administrator.class));

    Configuration configuration = afWeaver.getConfiguration();
    Set<String> ignoringAnnotations = configuration.getIgnoringAnnotations();

    assertEquals(ignoringAnnotations.size(), 3);
View Full Code Here

  }

  private void setUpDefaults() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(emptyConfigurationName));
    afWeaver = new AFWeaver(emptyConfigurationName, new JavaInspector(Administrator.class));
  }
View Full Code Here

  }

  private void setUpNoDefaults() throws AFException, FileNotFoundException {
    AFWeaver.init(new FileInputStream(getResource(AF_EMPTY_PROPS)));
    AFWeaver.addStaticConfiguration(getConfig(configurationName));
    afWeaver = new AFWeaver(configurationName, new JavaInspector(Administrator.class));
  }
View Full Code Here

    // ignoreAnnotation : Email Column NotNull
    AFWeaver.addStaticConfiguration(getConfig(configurationName));
    // ignore : none
    // ignoreAnnotation : empty
    AFWeaver.addStaticConfiguration(getConfig(noItemConfigurationName));
    afWeaver = new AFWeaver(configurationName, new JavaInspector(Administrator.class));
    Configuration configuration = afWeaver.getConfiguration();
    afWeaver = new AFWeaver(noItemConfigurationName, new JavaInspector(Administrator.class));
    Configuration configuration2 = afWeaver.getConfiguration();
    // expects : version fullName id secret password
    Set<String> fields = configuration.getIgnoreFields();
    // expects : UiIgnore Transient Email Column NotNull
    Set<String> annotations = configuration.getIgnoringAnnotations();
View Full Code Here

  /**
   * Gets AF per request
   */
  protected void initializeAF() throws AFException {
    // per request!
    afWeaver = new AFWeaver(getConfig());
  }
View Full Code Here

    if (afWeaver == null) {
      mutex.lock();
      if (afWeaver == null) {
        // compiler = new NinjaCompiler();
        try {
          afWeaver = new AFWeaver(getConfig());
          FacesContext.getCurrentInstance().getExternalContext().getSessionMap()
            .put(ASPECT_FACES, afWeaver);
        } catch (Exception e) {
          throw new AFException("Cannot initiate AspectFaces instance", e);
        }
View Full Code Here

TOP

Related Classes of com.codingcrayons.aspectfaces.AFWeaver

Copyright © 2018 www.massapicom. 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.