use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent in project kie-wb-common by kiegroup.
the class PersistencePresenterTest method testSetPersistenceProvider.
@Test
public void testSetPersistenceProvider() {
final PersistenceDescriptorEditorContent model = newPersistenceDescriptorEditorContent();
persistencePresenter.persistenceDescriptorEditorContent = model;
persistencePresenter.setPersistenceProvider("PersistenceProvider");
Assert.assertEquals("PersistenceProvider", model.getDescriptorModel().getPersistenceUnit().getProvider());
verify(persistencePresenter).fireChangeEvent();
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent in project kie-wb-common by kiegroup.
the class PersistencePresenterTest method testSetPersistenceUnit.
@Test
public void testSetPersistenceUnit() {
final PersistenceDescriptorEditorContent model = newPersistenceDescriptorEditorContent();
persistencePresenter.persistenceDescriptorEditorContent = model;
persistencePresenter.setPersistenceUnit("PersistenceUnit");
Assert.assertEquals("PersistenceUnit", model.getDescriptorModel().getPersistenceUnit().getName());
verify(persistencePresenter).fireChangeEvent();
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent in project kie-wb-common by kiegroup.
the class PersistencePresenterTest method testSetDataSource.
@Test
public void testSetDataSource() {
final PersistenceDescriptorEditorContent model = newPersistenceDescriptorEditorContent();
persistencePresenter.persistenceDescriptorEditorContent = model;
persistencePresenter.setDataSource("DataSource");
Assert.assertEquals("DataSource", model.getDescriptorModel().getPersistenceUnit().getJtaDataSource());
verify(persistencePresenter).fireChangeEvent();
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent in project kie-wb-common by kiegroup.
the class PersistencePresenterTest method newPersistenceDescriptorEditorContent.
private PersistenceDescriptorEditorContent newPersistenceDescriptorEditorContent() {
final PersistenceDescriptorEditorContent content = new PersistenceDescriptorEditorContent();
final PersistenceDescriptorModel model = new PersistenceDescriptorModel();
model.setVersion("2.0");
final PersistenceUnitModel unitModel = new PersistenceUnitModel();
model.setPersistenceUnit(unitModel);
unitModel.setName("UnitName");
unitModel.setTransactionType(TransactionType.JTA);
unitModel.setProvider("ProviderClass");
unitModel.setJtaDataSource("JTADataSource");
unitModel.setClasses(Arrays.asList("Class1", "Class2"));
content.setDescriptorModel(model);
content.setOverview(new Overview());
return content;
}
use of org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent in project kie-wb-common by kiegroup.
the class PersistenceDescriptorEditorServiceImpl method constructContent.
@Override
protected PersistenceDescriptorEditorContent constructContent(Path path, Overview overview) {
PersistenceDescriptorEditorContent content = new PersistenceDescriptorEditorContent();
PersistenceDescriptorModel descriptorModel = descriptorService.load(path);
content.setDescriptorModel(descriptorModel);
content.setOverview(overview);
content.setSource(ioService.readAllString(Paths.convert(path)));
return content;
}
Aggregations