String encodedString = writer.toString();
return new StringAsset( encodedString );
}
private static Asset createPersistenceXml() {
PersistenceDescriptor pd = Descriptors.create( PersistenceDescriptor.class ).version( "2.0" );
PersistenceUnit<PersistenceDescriptor> pu = pd.createPersistenceUnit()
.name( "primary" )
.jtaDataSource( System.getProperty( "datasource", "java:jboss/datasources/ExampleDS" ) );
Properties properties = scenario.getHibernateProperties();
properties.setProperty( "hibernate.transaction.factory_class", "org.hibernate.engine.transaction.internal.jta.JtaTransactionFactory" );
for ( Entry<Object, Object> property : properties.entrySet() ) {
pu.getOrCreateProperties().
createProperty().
name( property.getKey().toString() ).
value( property.getValue().toString() );
}
return new StringAsset( pd.exportAsString() );
}