Search in sources :

Example 1 with PersistenceDescriptorEditorContent

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();
}
Also used : PersistenceDescriptorEditorContent(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent) Test(org.junit.Test)

Example 2 with PersistenceDescriptorEditorContent

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();
}
Also used : PersistenceDescriptorEditorContent(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent) Test(org.junit.Test)

Example 3 with PersistenceDescriptorEditorContent

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();
}
Also used : PersistenceDescriptorEditorContent(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent) Test(org.junit.Test)

Example 4 with PersistenceDescriptorEditorContent

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;
}
Also used : PersistenceUnitModel(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceUnitModel) PersistenceDescriptorEditorContent(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent) Overview(org.guvnor.common.services.shared.metadata.model.Overview) PersistenceDescriptorModel(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorModel)

Example 5 with PersistenceDescriptorEditorContent

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;
}
Also used : PersistenceDescriptorEditorContent(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent) PersistenceDescriptorModel(org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorModel)

Aggregations

PersistenceDescriptorEditorContent (org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorEditorContent)8 Test (org.junit.Test)5 PersistenceDescriptorModel (org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceDescriptorModel)2 Path (org.uberfire.backend.vfs.Path)2 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)1 Overview (org.guvnor.common.services.shared.metadata.model.Overview)1 PersistenceUnitModel (org.kie.workbench.common.screens.datamodeller.model.persistence.PersistenceUnitModel)1