@Test public void webApplicationContextIsLoaded() { // from: src/test/webapp/resources/Spring.js Resource resource = wac.getResource("/resources/Spring.js"); assertNotNull(resource); assertTrue(resource.exists()); }
public void loadDataFixtures() { if (loadDataFixtures) { ResourceDatabasePopulator populator = new ResourceDatabasePopulator(context.getResource("classpath:/data.sql")); DatabasePopulatorUtils.execute(populator, ds); loadDataFixtures = false;
protected final Resource getTemplateResource(final String name) { return trimToNull(name) == null ? null : wac.getResource(TEMPLATES_CLASSPATH + name); }
/** * Get all includes for properties from the sitemap. * @param sitemap * @return */ protected static List getPropertiesIncludes(WebApplicationContext webAppContext, String contextUrl, Configuration sitemap) throws ConfigurationException { final List includes = new ArrayList(); if ( isUsingDefaultIncludes(sitemap) ) { final Resource rsrc = webAppContext.getResource(contextUrl + DEFAULT_CHILD_PROPERTIES_LOCATION); if ( rsrc.exists() ) { includes.add(DEFAULT_CHILD_PROPERTIES_LOCATION); } } final Configuration[] includeConfigs = sitemap.getChild("components").getChildren("include-properties"); for(int i = 0 ; i < includeConfigs.length; i++ ) { final String dir = includeConfigs[i].getAttribute("dir"); includes.add(dir); } return includes; }
/** * Get all includes for bean configurations from the sitemap. * @param sitemap * @return */ protected static List getBeanIncludes(WebApplicationContext webAppContext, String contextUrl, Configuration sitemap) throws ConfigurationException { final List includes = new ArrayList(); if ( isUsingDefaultIncludes(sitemap) ) { final Resource rsrc = webAppContext.getResource(contextUrl + DEFAULT_CHILD_SPRING_CONFIGURATION_LOCATION); if ( rsrc.exists() ) { includes.add(DEFAULT_CHILD_SPRING_CONFIGURATION_LOCATION); } } final Configuration[] includeConfigs = sitemap.getChild("components").getChildren("include-beans"); for(int i = 0 ; i < includeConfigs.length; i++ ) { final String dir = includeConfigs[i].getAttribute("dir"); includes.add(dir); } return includes; }
@Override public void init(FilterConfig config) throws ServletException { ServletContext servletContext = config.getServletContext(); WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext.getAutowireCapableBeanFactory(); autowireCapableBeanFactory.autowireBean(this); X509Certificate certificate; try { Resource resource = webApplicationContext.getResource(tokenConfig.getCertificateLocation()); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); certificate = (X509Certificate) certificateFactory.generateCertificate(resource.getInputStream()); } catch (Exception ex) { throw new ServletException(ex); } Configuration configuration = Configuration.getInstance(); configuration.setMaxTokenValidityInMinutes(tokenConfig.getMaxTokenValidityInMinutes()); configuration.setCertificate(certificate); }
@Override public void init(FilterConfig config) throws ServletException { ServletContext servletContext = config.getServletContext(); WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext); AutowireCapableBeanFactory autowireCapableBeanFactory = webApplicationContext.getAutowireCapableBeanFactory(); autowireCapableBeanFactory.autowireBean(this); X509Certificate certificate; try { Resource resource = webApplicationContext.getResource(tokenConfig.getCertificateLocation()); CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); certificate = (X509Certificate) certificateFactory.generateCertificate(resource.getInputStream()); } catch (Exception ex) { throw new ServletException(ex); } Configuration configuration = Configuration.getInstance(); configuration.setMaxTokenValidityInMinutes(tokenConfig.getMaxTokenValidityInMinutes()); configuration.setCertificate(certificate); } }
inputStream = ctx.getResource( "/buildversion.properties" ).getInputStream(); logger.debug( "/buildversion.properties not found" ); inputStream = ctx.getResource( "/institution/buildversion.properties" ).getInputStream(); if ( inputStream == null ) { if ( DEBUG ) { logger.debug( "/institution/buildversion.properties not found" ); inputStream = ctx.getResource( "/central/buildversion.properties" ).getInputStream(); if ( inputStream == null && DEBUG ) { logger.debug( "/central/buildversion.properties not found" );
@Before public void setup() throws Exception { super.setup(); Chromosome testChromosome = EntityHelper.createNewChromosome(); testChromosome.setSize(TEST_CHROMOSOME_SIZE); testReference = EntityHelper.createNewReference(testChromosome, referenceGenomeManager.createReferenceId()); referenceGenomeManager.register(testReference); referenceId = testReference.getId(); Resource resource = wac.getResource(CLASSPATH_TEMPLATES_GENES_SORTED); FeatureIndexedFileRegistrationRequest request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceId); request.setPath(resource.getFile().getAbsolutePath()); geneFile = gffManager.registerGeneFile(request); Assert.assertNotNull(geneFile); Assert.assertNotNull(geneFile.getId()); referenceGenomeManager.updateReferenceGeneFileId(testReference.getId(), geneFile.getId()); resource = wac.getResource(CLASSPATH_TEMPLATES_FELIS_CATUS_VCF); request = new FeatureIndexedFileRegistrationRequest(); request.setReferenceId(referenceId); request.setPath(resource.getFile().getAbsolutePath()); vcfFile = vcfManager.registerVcfFile(request); }