use of org.webpieces.util.file.VirtualFileClasspath in project webpieces by deanhiller.
the class TestAjaxHibernate method setUp.
@Before
public void setUp() {
//clear in-memory database
JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
jdbc.dropAllTablesFromDatabase();
VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
TestConfig config = new TestConfig();
config.setPlatformOverrides(platformOverrides);
config.setAppOverrides(new TestModule());
config.setMetaFile(metaFile);
WebserverForTest webserver = new WebserverForTest(config);
webserver.start();
http11Socket = http11Simulator.openHttp();
}
use of org.webpieces.util.file.VirtualFileClasspath in project webpieces by deanhiller.
the class TestAsyncHibernate method setUp.
@Before
public void setUp() {
//clear in-memory database
JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
jdbc.dropAllTablesFromDatabase();
mockExecutor.clear();
VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
TestConfig config = new TestConfig();
config.setPlatformOverrides(platformOverrides);
config.setAppOverrides(new TestOverrides());
config.setMetaFile(metaFile);
WebserverForTest webserver = new WebserverForTest(config);
webserver.start();
http11Socket = http11Simulator.openHttp();
}
use of org.webpieces.util.file.VirtualFileClasspath in project webpieces by deanhiller.
the class TestFlashAndSelect method setUp.
@Before
public void setUp() {
//clear in-memory database
JdbcApi jdbc = JdbcFactory.create(JdbcConstants.jdbcUrl, JdbcConstants.jdbcUser, JdbcConstants.jdbcPassword);
jdbc.dropAllTablesFromDatabase();
user = loadDataInDb();
VirtualFileClasspath metaFile = new VirtualFileClasspath("plugins/hibernateMeta.txt", WebserverForTest.class.getClassLoader());
TestConfig config = new TestConfig();
config.setPlatformOverrides(platformOverrides);
config.setMetaFile(metaFile);
config.setAppOverrides(new TestModule(mock));
WebserverForTest webserver = new WebserverForTest(config);
webserver.start();
http11Socket = http11Simulator.openHttp();
}
use of org.webpieces.util.file.VirtualFileClasspath in project webpieces by deanhiller.
the class TestUrlHtmlEncoding method setUp.
@Before
public void setUp() {
VirtualFileClasspath metaFile = new VirtualFileClasspath("beansMeta.txt", WebserverForTest.class.getClassLoader());
WebserverForTest webserver = new WebserverForTest(platformOverrides, null, false, metaFile);
webserver.start();
http11Socket = http11Simulator.openHttp();
}
use of org.webpieces.util.file.VirtualFileClasspath in project webpieces by deanhiller.
the class DevTemplateService method loadTemplateImpl.
private Template loadTemplateImpl(OurGroovyClassLoader cl, String fullTemplatePath, String templateFullClassName) throws IOException, ClassNotFoundException {
if (config.isMustReadClassFromFileSystem()) {
//shortcut for tests that use PlatformOverridesForTest to ensure we test the production groovy class files AND
//it ensures we give code coverage numbers on those class files as well.
Class<?> compiledTemplate = DevTemplateService.class.getClassLoader().loadClass(templateFullClassName);
return new TemplateImpl(urlLookup, htmlTagLookup, compiledTemplate);
}
VirtualFile theResource = null;
List<VirtualFile> srcPaths = config.getSrcPaths();
for (VirtualFile f : srcPaths) {
//take off the leading '/' so it is a relative path
VirtualFile child = f.child(fullTemplatePath.substring(1));
if (child.exists()) {
theResource = child;
break;
}
}
if (theResource == null)
theResource = new VirtualFileClasspath(fullTemplatePath, DevTemplateService.class);
if (!theResource.exists())
throw new FileNotFoundException("resource=" + fullTemplatePath + " was not found in classpath");
try (InputStream resource = theResource.openInputStream()) {
String viewSource = IOUtils.toString(resource, config.getFileEncoding().name());
Class<?> compiledTemplate = createTemplate(cl, templateFullClassName, viewSource);
return new TemplateImpl(urlLookup, htmlTagLookup, compiledTemplate);
}
}
Aggregations