use of org.pentaho.metadata.model.LogicalModel in project data-access by pentaho.
the class DatasourceModel method setDatasourceName.
@Bindable
public void setDatasourceName(String datasourceName) {
String previousVal = this.datasourceName;
this.datasourceName = datasourceName;
// we need to keep the datasource name in sync
if (domain != null) {
domain.setId(datasourceName);
LogicalModel model = domain.getLogicalModels().get(0);
String localeCode = domain.getLocales().get(0).getCode();
model.getName().setString(localeCode, datasourceName);
}
this.getModelInfo().setStageTableName(generateTableName());
// $NON-NLS-1$
this.firePropertyChange("datasourceName", previousVal, datasourceName);
validate();
}
use of org.pentaho.metadata.model.LogicalModel in project data-access by pentaho.
the class DataSourceWizardServiceTest method testGetDSWDatasourceIds.
@Test
public void testGetDSWDatasourceIds() throws Exception {
Domain mockDomain = mock(Domain.class);
LogicalModelSummary mockLogicalModelSummary = mock(LogicalModelSummary.class);
List<LogicalModelSummary> mockLogicalModelSummaryList = new ArrayList<LogicalModelSummary>();
mockLogicalModelSummaryList.add(mockLogicalModelSummary);
List<LogicalModel> mockLogicalModelList = new ArrayList<LogicalModel>();
LogicalModel mockLogicalModel = mock(LogicalModel.class);
mockLogicalModelList.add(mockLogicalModel);
Object mockObject = mock(Object.class);
List<String> datasourceList = new ArrayList<String>();
datasourceList.add(mockLogicalModelSummary.getDomainId());
doReturn(mockLogicalModelSummaryList).when(dataSourceWizardService.dswService).getLogicalModels(null);
doReturn(mockDomain).when(dataSourceWizardService.modelerService).loadDomain(anyString());
doReturn(mockLogicalModelList).when(mockDomain).getLogicalModels();
doReturn(mockObject).when(mockLogicalModel).getProperty("AGILE_BI_GENERATED_SCHEMA");
List<String> response = dataSourceWizardService.getDSWDatasourceIds();
assertEquals(datasourceList, response);
verify(dataSourceWizardService, times(1)).getDSWDatasourceIds();
}
use of org.pentaho.metadata.model.LogicalModel in project data-access by pentaho.
the class DatasourceServiceTest method isMetadataDomainTest.
@Test
public void isMetadataDomainTest() throws ObjectFactoryException {
// given
Domain domain = mock(Domain.class);
List<LogicalModel> logicalModelList = new ArrayList<>();
LogicalModel model = new LogicalModel();
LogicalModel model2 = new LogicalModel();
// when
assertFalse(DatasourceService.isMetadataDatasource((Domain) null));
assertTrue(DatasourceService.isMetadataDatasource(domain));
logicalModelList.add(model);
when(domain.getLogicalModels()).thenReturn(logicalModelList);
assertTrue(DatasourceService.isMetadataDatasource(domain));
model.setProperty("AGILE_BI_GENERATED_SCHEMA", true);
assertFalse(DatasourceService.isMetadataDatasource(domain));
model2.setProperty("WIZARD_GENERATED_SCHEMA", true);
logicalModelList.clear();
logicalModelList.add(model2);
assertFalse(DatasourceService.isMetadataDatasource(domain));
}
Aggregations