use of org.apache.tapestry5.ioc.internal.util.ClasspathResource in project tapestry-5 by apache.
the class EntityManagerSourceImplTest method create.
private EntityManagerSourceImpl create(final String persistenceUnitFile) {
PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer() {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public void configure(TapestryPersistenceUnitInfo unitInfo) {
Map properties = new HashMap();
properties.put("MYKEY", "MYVALUE");
unitInfo.transactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL).persistenceProviderClassName("org.eclipse.persistence.jpa.PersistenceProvider").excludeUnlistedClasses(true).addProperty("javax.persistence.jdbc.user", "sa").addProperty("javax.persistence.jdbc.driver", "org.h2.Driver").addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:test").setEntityManagerProperties(properties);
}
};
Map<String, PersistenceUnitConfigurer> configurerMap = CollectionFactory.<String, PersistenceUnitConfigurer>newMap();
configurerMap.put("defaultpropertytest", configurer);
EntityManagerSourceImpl emSource = new EntityManagerSourceImpl(LoggerFactory.getLogger(EntityManagerSourceImplTest.class), new ClasspathResource(persistenceUnitFile), null, configurerMap);
return emSource;
}
use of org.apache.tapestry5.ioc.internal.util.ClasspathResource in project tapestry-5 by apache.
the class PropertiesFileParserImplTest method read_utf.
@Test
public void read_utf() throws Exception {
Resource utf8 = new ClasspathResource("org/apache/tapestry5/internal/services/messages/utf8.properties");
PropertiesFileParser parser = getService(PropertiesFileParser.class);
Map<String, String> properties = parser.parsePropertiesFile(utf8);
assertEquals(properties.get("tapestry"), "\u30bf\u30da\u30b9\u30c8\u30ea\u30fc");
assertEquals(properties.get("version"), "5");
}
Aggregations