use of org.apache.tapestry5.integration.app1.data.Entity in project epsilon-runtime by BlackBeltTechnology.
the class EntityReferenceImpl method setTarget.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTarget(Entity newTarget) {
Entity oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DataPackage.ENTITY_REFERENCE__TARGET, oldTarget, target));
}
use of org.apache.tapestry5.integration.app1.data.Entity in project tapestry-5 by apache.
the class HibernateSessionSourceImplTest method startup_without_packages.
@Test
public void startup_without_packages() {
Collection<String> packageNames = CollectionFactory.newList("org.example.myapp.entities", "org.example.app0.entities");
HibernateEntityPackageManager packageManager = newMock(HibernateEntityPackageManager.class);
TestBase.expect(packageManager.getPackageNames()).andReturn(packageNames);
ClasspathScannerImpl scanner = new ClasspathScannerImpl(new ClasspathURLConverterImpl());
ClassNameLocatorImpl classNameLocator = new ClassNameLocatorImpl(scanner);
List<HibernateConfigurer> filters = Arrays.asList(new DefaultHibernateConfigurer(true), new PackageNameHibernateConfigurer(packageManager, classNameLocator));
replay();
HibernateSessionSource source = new HibernateSessionSourceImpl(log, filters);
Session session = source.create();
Assert.assertNotNull(session);
// make sure it found the entity in the package
ClassMetadata meta = session.getSessionFactory().getClassMetadata(User.class);
Assert.assertEquals(meta.getEntityName(), "org.example.app0.entities.User");
verify();
}
use of org.apache.tapestry5.integration.app1.data.Entity in project tapestry-5 by apache.
the class EntityPersistentFieldStrategyTest method transient_entity.
public void transient_entity() {
SampleEntity entity = new SampleEntity();
Session session = newMock(Session.class);
EntityPersistentFieldStrategy strategy = new EntityPersistentFieldStrategy(session, null);
expect(session.contains(entity)).andReturn(false);
replay();
Object persisted = strategy.convertApplicationValueToPersisted(entity);
assert persisted instanceof SessionRestorable;
Object restored = strategy.convertPersistedToApplicationValue(persisted);
assertSame(entity, restored);
verify();
}
use of org.apache.tapestry5.integration.app1.data.Entity in project tapestry-5 by apache.
the class EntityPersistentFieldStrategyTest method persistent_entity.
public void persistent_entity() {
SampleEntity entity = new SampleEntity();
SampleEntity restoredEntity = new SampleEntity();
Session session = newMock(Session.class);
EntityPersistentFieldStrategy strategy = new EntityPersistentFieldStrategy(session, null);
expect(session.contains(entity)).andReturn(true);
expect(session.getEntityName(entity)).andReturn("SampleEntity");
expect(session.getIdentifier(entity)).andReturn(42);
expect(session.get("SampleEntity", 42)).andReturn(restoredEntity);
replay();
Object persisted = strategy.convertApplicationValueToPersisted(entity);
assert persisted instanceof SessionRestorable;
Object restored = strategy.convertPersistedToApplicationValue(persisted);
assertSame(restored, restoredEntity);
verify();
}
use of org.apache.tapestry5.integration.app1.data.Entity in project tapestry-5 by apache.
the class DefaultOpenApiDescriptionGenerator method generateSchemas.
private void generateSchemas(JSONObject documentation) {
if (!entities.isEmpty()) {
JSONObject components = new JSONObject();
JSONObject schemas = new JSONObject();
for (Class<?> entity : entities) {
typeDescriber.describeSchema(entity, schemas);
}
components.put("schemas", schemas);
documentation.put("components", components);
}
}
Aggregations