Package org.springframework.ui.velocity

Examples of org.springframework.ui.velocity.VelocityEngineFactoryBean.afterPropertiesSet()


    vefb.setConfigLocation(new FileSystemResource("myprops.properties"));
    Properties props = new Properties();
    props.setProperty("myprop", "/mydir");
    vefb.setVelocityProperties(props);
    try {
      vefb.afterPropertiesSet();
      fail("Should have thrown IOException");
    }
    catch (IOException ex) {
      // expected
    }
View Full Code Here


    vefb.setVelocityProperties(props);
    Object value = new Object();
    Map map = new HashMap();
    map.put("myentry", value);
    vefb.setVelocityPropertiesMap(map);
    vefb.afterPropertiesSet();
    assertTrue(vefb.getObject() instanceof VelocityEngine);
    VelocityEngine ve = (VelocityEngine) vefb.getObject();
    assertEquals("/mydir", ve.getProperty("myprop"));
    assertEquals(value, ve.getProperty("myentry"));
  }
View Full Code Here

  }

  public void testVelocityEngineFactoryBeanWithResourceLoaderPath() throws IOException, VelocityException {
    VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean();
    vefb.setResourceLoaderPath("file:/mydir");
    vefb.afterPropertiesSet();
    assertTrue(vefb.getObject() instanceof VelocityEngine);
    VelocityEngine ve = (VelocityEngine) vefb.getObject();
    assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH));
  }
View Full Code Here

      }
      public ClassLoader getClassLoader() {
        return getClass().getClassLoader();
      }
    });
    vefb.afterPropertiesSet();
    assertTrue(vefb.getObject() instanceof VelocityEngine);
    VelocityEngine ve = (VelocityEngine) vefb.getObject();
    assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap()));
  }
View Full Code Here

    vefb.setConfigLocation(new FileSystemResource("myprops.properties"));
    Properties props = new Properties();
    props.setProperty("myprop", "/mydir");
    vefb.setVelocityProperties(props);
    try {
      vefb.afterPropertiesSet();
      fail("Should have thrown IOException");
    }
    catch (IOException ex) {
      // expected
    }
View Full Code Here

    vefb.setVelocityProperties(props);
    Object value = new Object();
    Map map = new HashMap();
    map.put("myentry", value);
    vefb.setVelocityPropertiesMap(map);
    vefb.afterPropertiesSet();
    assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
    VelocityEngine ve = vefb.getObject();
    assertEquals("/mydir", ve.getProperty("myprop"));
    assertEquals(value, ve.getProperty("myentry"));
  }
View Full Code Here

  }

  public void testVelocityEngineFactoryBeanWithResourceLoaderPath() throws IOException, VelocityException {
    VelocityEngineFactoryBean vefb = new VelocityEngineFactoryBean();
    vefb.setResourceLoaderPath("file:/mydir");
    vefb.afterPropertiesSet();
    assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
    VelocityEngine ve = vefb.getObject();
    assertEquals(new File("/mydir").getAbsolutePath(), ve.getProperty(VelocityEngine.FILE_RESOURCE_LOADER_PATH));
  }
View Full Code Here

      @Override
      public ClassLoader getClassLoader() {
        return getClass().getClassLoader();
      }
    });
    vefb.afterPropertiesSet();
    assertThat(vefb.getObject(), instanceOf(VelocityEngine.class));
    VelocityEngine ve = vefb.getObject();
    assertEquals("test", VelocityEngineUtils.mergeTemplateIntoString(ve, "test", new HashMap()));
  }
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.