use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.
the class ModuleDataSourceExplorer method onModuleSelected.
public void onModuleSelected(final Module module) {
if (hasChanged(module)) {
DefExplorerQuery query = new DefExplorerQuery();
if (activeOrganizationalUnit != null && activeRepository != null) {
activeModule = module;
query.setOrganizationalUnit(activeOrganizationalUnit);
query.setRepository(activeRepository);
query.setBranchName(activeRepository.getDefaultBranch().get().getName());
query.setModule(module);
} else {
activeModule = null;
}
refresh(query);
}
}
use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.
the class ModuleDataSourceExplorer method onOrganizationalUnitSelected.
public void onOrganizationalUnitSelected(final OrganizationalUnit ou) {
if (hasChanged(ou)) {
activeOrganizationalUnit = ou;
activeRepository = null;
activeModule = null;
DefExplorerQuery query = new DefExplorerQuery();
query.setOrganizationalUnit(ou);
refresh(query);
}
}
use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.
the class DefExplorerQueryServiceTest method testQueryForOrganizationalUnitRepository.
/**
* Tests a query for a given Organizational Unit and a given repository. In this case the list of available
* authorized modules for the given repository should be returned.
*/
@Test
public void testQueryForOrganizationalUnitRepository() {
DefExplorerQuery query = new DefExplorerQuery();
query.setOrganizationalUnit(o3);
query.setRepository(repo_o3_3);
query.setBranchName("master");
DefExplorerQueryResult result = explorerQueryService.executeQuery(query);
verifyResultForQueryForOrganizationalUnitRepository(result);
}
use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery in project kie-wb-common by kiegroup.
the class DefExplorerQueryServiceTest method testQueryForOrganizationalUnit.
/**
* Tests a query for a given Organizational Unit as the only parameter. In this case the query should return the
* list of available authorized repositories for the selected OU.
*/
@Test
public void testQueryForOrganizationalUnit() {
DefExplorerQuery query = new DefExplorerQuery();
query.setOrganizationalUnit(o2);
DefExplorerQueryResult result = explorerQueryService.executeQuery(query);
// o1 should not be included in the result since it's not authorized.
assertFalse(result.getOrganizationalUnits().contains(o1));
// o2 must be included in the result.
assertTrue(result.getOrganizationalUnits().contains(o2));
// o3 is still included in the result since organizational units are piggybacked to let the UI be refreshed
assertTrue(result.getOrganizationalUnits().contains(o3));
// authorized repositories for organizational unit o2 must be in the result.
assertTrue(result.getRepositories().contains(repo_o2_1));
assertTrue(result.getRepositories().contains(repo_o2_2));
assertEquals(2, result.getRepositories().size());
}
use of org.kie.workbench.common.screens.datasource.management.service.DefExplorerQuery 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());
}
Aggregations