Search in sources :

Example 6 with DefExplorerQueryResult

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

the class DefExplorerQueryServiceTest method testEmptyQuery.

/**
 * Tests a query with no parameters, basically should return the list of organizational units accessible by current user.
 */
@Test
public void testEmptyQuery() {
    DefExplorerQuery query = new DefExplorerQuery();
    DefExplorerQueryResult result = explorerQueryService.executeQuery(query);
    // o1 should not be included in the result.
    assertFalse(result.getOrganizationalUnits().contains(o1));
    // o2 must be included in the result.
    assertTrue(result.getOrganizationalUnits().contains(o2));
    // o3 must be included in the result.
    assertTrue(result.getOrganizationalUnits().contains(o3));
    // repositories, modules, data sources and drivers should be empty since no organizational unit was selected
    assertTrue(result.getRepositories().isEmpty());
    assertTrue(result.getModules().isEmpty());
    assertTrue(result.getDataSourceDefs().isEmpty());
    assertTrue(result.getModules().isEmpty());
}
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 DefExplorerQueryResult

use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQueryResult 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)

Aggregations

DefExplorerQueryResult (org.kie.workbench.common.screens.datasource.management.service.DefExplorerQueryResult)7 Test (org.junit.Test)4 DefExplorerQuery (org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery)4 Module (org.guvnor.common.services.project.model.Module)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 Repository (org.guvnor.structure.repositories.Repository)1