@Test public void testSaveAndLoad() { try (ODatabaseDocumentTx db = database.getInstance().connect()) { entityAdapter.register(db); ClusteredModelVersions entity = entityAdapter.get(db); assertThat(entity, is(notNullValue())); assertThat(entity.getModelVersions().entrySet(), hasSize(0)); assertThat(entity.isDirty(), is(false)); entity = new ClusteredModelVersions(); assertThat(entity.isDirty(), is(false)); entity.put("model-a", "1.2"); entity.put("model-b", "2.1"); assertThat(entity.isDirty(), is(true)); entityAdapter.set(db, entity); entity = entityAdapter.get(db); assertThat(entity, is(notNullValue())); assertThat(entity.getModelVersions(), hasEntry("model-a", "1.2")); assertThat(entity.getModelVersions(), hasEntry("model-b", "2.1")); assertThat(entity.getModelVersions().entrySet(), hasSize(2)); assertThat(entity.isDirty(), is(false)); entity.put("model-a", "1.3"); assertThat(entity.isDirty(), is(true)); entityAdapter.set(db, entity); entity = entityAdapter.get(db); assertThat(entity, is(notNullValue())); assertThat(entity.getModelVersions(), hasEntry("model-a", "1.3")); assertThat(entity.getModelVersions(), hasEntry("model-b", "2.1")); assertThat(entity.getModelVersions().entrySet(), hasSize(2)); assertThat(entity.isDirty(), is(false)); } }
public ClusteredModelVersions get(ODatabaseDocumentTx db) { ClusteredModelVersions entity = super.get(db); if (entity == null) { entity = newEntity(); } return entity; }
ClusteredModelVersionsEntityAdapter extends SingletonEntityAdapter<ClusteredModelVersions> { public ClusteredModelVersions get(ODatabaseDocumentTx db) { ClusteredModelVersions entity = super.get(db); if (entity == null) { entity = newEntity(); } return entity; } }
ClusteredModelVersionsEntityAdapter extends SingletonEntityAdapter<ClusteredModelVersions> { public ClusteredModelVersions get(ODatabaseDocumentTx db) { ClusteredModelVersions entity = super.get(db); if (entity == null) { entity = newEntity(); } return entity; } ClusteredModelVersionsEntityAdapter(); }
ClusteredModelVersionsEntityAdapter extends SingletonEntityAdapter<ClusteredModelVersions> { public ClusteredModelVersions get(ODatabaseDocumentTx db) { ClusteredModelVersions entity = super.get(db); if (entity == null) { entity = newEntity(); } return entity; } ClusteredModelVersionsEntityAdapter(); ClusteredModelVersions get(ODatabaseDocumentTx db); }
ClusteredModelVersionsEntityAdapter extends SingletonEntityAdapter<ClusteredModelVersions> { public ClusteredModelVersions get(ODatabaseDocumentTx db) { ClusteredModelVersions entity = super.get(db); if (entity == null) { entity = newEntity(); } return entity; } ClusteredModelVersionsEntityAdapter(); ClusteredModelVersions get(ODatabaseDocumentTx db);  }