List of usage examples for org.springframework.core.io ClassPathResource ClassPathResource
public ClassPathResource(String path)
From source file:org.impotch.calcul.impot.cantonal.ge.pp.avant2010.BaremeRevenuFamille1995Test.java
@Parameterized.Parameters public static Collection<Object[]> data() throws IOException { ChargeurFichierEconometre chargeur = new ChargeurFichierEconometre(); chargeur.setFichier(new ClassPathResource("ge/BASEIMP.CSV")); return Arrays.asList(chargeur.charger(1995, true)); }
From source file:CommentTest.java
@Test public void findAllCommentTestByTopicId() { ListableBeanFactory bf;/*w ww . j a v a 2s . co m*/ bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); ICommentaireMetier m = (ICommentaireMetier) bf.getBean("commentaireMetier"); List<Commentaire> u = m.findAllByIdTopics(38); System.out.print("Je suis ici"); for (Commentaire p : u) { System.out.println("nom=" + p.getComment_text()); } if (u.isEmpty()) { System.out.println("LA LISTE EST VIDE !"); } }
From source file:de.ingrid.admin.security.IngridRealm.java
public IngridRealm() throws IOException { ClassPathResource authFile = new ClassPathResource("ingrid.auth"); System.setProperty("java.security.auth.login.config", authFile.getFile().getPath()); }
From source file:org.haedus.io.ClassPathFileHandler.java
@Override public List<String> readLines(String path) { List<String> lines = new ArrayList<String>(); InputStreamSource resource = new ClassPathResource(path); try {/*from w w w. j av a2 s . c o m*/ InputStream inputStream = resource.getInputStream(); lines.addAll(IOUtils.readLines(inputStream, encoding)); inputStream.close(); } catch (IOException e) { LOGGER.error("Error when reading from path \"{}\"!", path); } return lines; }
From source file:rmblworx.tools.timey.ApplicationProperties.java
/** * @return Versionskennung oder {@code null}, wenn sie nicht ermittelt werden kann. *//* ww w . j a va 2 s . c o m*/ public String getVersion() { try { if (inputStream == null) { inputStream = new ClassPathResource(PROPERTY_FILENAME).getInputStream(); } if (properties == null) { properties = new Properties(); } properties.load(inputStream); return properties.getProperty(PROP_APP_VERSION); } catch (final IOException e) { log.error("Error while trying to read the property file: " + e.getLocalizedMessage()); return null; } finally { TimeyUtils.closeQuietly(inputStream); } }
From source file:CategorieTest.java
@Test public void testJDBCFindAllById() { ListableBeanFactory bf;//from ww w.jav a 2 s .co m bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml")); ICategorieMetier m = (ICategorieMetier) bf.getBean("categorieMetier"); System.out.print("Je suis ici"); List<Categorie> u = m.findAllC(); System.out.print("Je suis ici"); for (Categorie p : u) { System.out.println("nom=" + p.getCat_id()); } }
From source file:org.canova.api.records.reader.impl.SVMRecordWriterTest.java
@Test public void testWriter() throws Exception { InputStream is = new ClassPathResource("iris.dat").getInputStream(); assumeNotNull(is);/*from ww w. j a v a2 s . com*/ File tmp = new File("iris.txt"); BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(tmp)); IOUtils.copy(is, bos); bos.flush(); bos.close(); InputSplit split = new FileSplit(tmp); tmp.deleteOnExit(); RecordReader reader = new CSVRecordReader(); List<Collection<Writable>> records = new ArrayList<>(); reader.initialize(split); while (reader.hasNext()) { Collection<Writable> record = reader.next(); assertEquals(5, record.size()); records.add(record); } assertEquals(150, records.size()); File out = new File("iris_out.txt"); out.deleteOnExit(); RecordWriter writer = new SVMLightRecordWriter(out, true); for (Collection<Writable> record : records) writer.write(record); writer.close(); records.clear(); RecordReader svmReader = new SVMLightRecordReader(); InputSplit svmSplit = new FileSplit(out); svmReader.initialize(svmSplit); assertTrue(svmReader.hasNext()); while (svmReader.hasNext()) { Collection<Writable> record = svmReader.next(); assertEquals(5, record.size()); records.add(record); } assertEquals(150, records.size()); }
From source file:org.apereo.services.persondir.support.xml.XmlPersonAttributeDaoTest.java
@Override protected void setUp() throws Exception { if (this.xmlPersonAttributeDao == null) { this.xmlPersonAttributeDao = new XmlPersonAttributeDao(); this.xmlPersonAttributeDao.setMappedXmlResource(new ClassPathResource("/PersonData.xml")); this.xmlPersonAttributeDao.afterPropertiesSet(); }//from ww w .j a v a 2 s.co m }
From source file:org.jasig.cas.web.support.GoogleAccountsArgumentExtractorTests.java
protected void setUp() throws Exception { final PublicKeyFactoryBean pubKeyFactoryBean = new PublicKeyFactoryBean(); final PrivateKeyFactoryBean privKeyFactoryBean = new PrivateKeyFactoryBean(); pubKeyFactoryBean.setAlgorithm("DSA"); privKeyFactoryBean.setAlgorithm("DSA"); final ClassPathResource pubKeyResource = new ClassPathResource("DSAPublicKey01.key"); final ClassPathResource privKeyResource = new ClassPathResource("DSAPrivateKey01.key"); pubKeyFactoryBean.setLocation(pubKeyResource); privKeyFactoryBean.setLocation(privKeyResource); assertTrue(privKeyFactoryBean.getObjectType().equals(PrivateKey.class)); assertTrue(pubKeyFactoryBean.getObjectType().equals(PublicKey.class)); pubKeyFactoryBean.afterPropertiesSet(); privKeyFactoryBean.afterPropertiesSet(); this.extractor = new GoogleAccountsArgumentExtractor(); this.extractor.setPrivateKey((PrivateKey) privKeyFactoryBean.getObject()); this.extractor.setPublicKey((PublicKey) pubKeyFactoryBean.getObject()); super.setUp(); }
From source file:com.eventattend.portal.Factory.UserFactory.java
public static UserController adminProfileInfo() throws Exception { ClassPathResource resource = new ClassPathResource("BusinessObjectFactory.xml"); BeanFactory factory = new XmlBeanFactory(resource); return (UserController) factory.getBean("User"); }