Search in sources :

Example 6 with DefExplorerQuery

use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.

the class DefExplorerQueryServiceTest method testQueryForOrganizationalUnitRepositoryModule.

/**
 * Tests a query for a given Organizational Unit, a Repository, and a selected Module.
 * In this case the list of available data sources and drivers for the given repository should be returned.
 */
@Test
public void testQueryForOrganizationalUnitRepositoryModule() {
    DefExplorerQuery query = new DefExplorerQuery();
    query.setOrganizationalUnit(o3);
    query.setRepository(repo_o3_1);
    query.setBranchName("master");
    query.setModule(module1);
    DefExplorerQueryResult result = explorerQueryService.executeQuery(query);
    // organizational units, repositories and modules are piggybacked, so the result should include
    // the same structure information as testQueryForOrganizationalUnitRepository
    verifyResultForQueryForOrganizationalUnitRepository(result);
    // additionally all data sources and drivers from module2 should be in the result.
    assertTrue(result.getDataSourceDefs().contains(ds1));
    assertTrue(result.getDataSourceDefs().contains(ds2));
    assertTrue(result.getDriverDefs().contains(driver1));
    assertTrue(result.getDriverDefs().contains(driver2));
    assertTrue(result.getDriverDefs().contains(driver3));
}
Also used : DefExplorerQuery(org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery) DefExplorerQueryResult(org.kie.workbench.common.screens.datasource.management.service.DefExplorerQueryResult) Test(org.junit.Test)

Example 7 with DefExplorerQuery

use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.

the class ModuleDataSourceExplorer method onRepositorySelected.

public void onRepositorySelected(final Repository repository) {
    if (hasChanged(repository)) {
        DefExplorerQuery query = new DefExplorerQuery();
        if (activeOrganizationalUnit != null) {
            activeRepository = repository;
            activeModule = null;
            query.setOrganizationalUnit(activeOrganizationalUnit);
            query.setRepository(repository);
            query.setBranchName(activeRepository.getDefaultBranch().get().getName());
        } else {
            activeRepository = null;
            activeModule = null;
        }
        refresh(query);
    }
}
Also used : DefExplorerQuery(org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery)

Aggregations

DefExplorerQuery (org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery)7 Test (org.junit.Test)4 DefExplorerQueryResult (org.kie.workbench.common.screens.datasource.management.service.DefExplorerQueryResult)4