@Override public int getNumberOfAssets(final ProjectAssetsQuery query) { HashSet<ValueIndexTerm> queryTerms = this.buildProjectAssetsQuery(query); return refactoringQueryService.queryHitCount(new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, queryTerms, 0, null)); }
@Override public int getNumberOfAssets(final WorkspaceProject module) { final HashSet<ValueIndexTerm> queryTerms = new HashSet<>(); queryTerms.add(new LibraryValueRepositoryRootIndexTerm(module.getRootPath().toURI())); return refactoringQueryService.queryHitCount(new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, queryTerms, 0, null, Boolean.TRUE)); }
private RefactoringPageRequest convertToRefactoringPageRequest(QueryOperationRequest refOpRequest) { RefactoringPageRequest request = new RefactoringPageRequest( FindAllChangeImpactQuery.NAME, new HashSet<>(),
@Test public void testQueryInvalidIndexTerms() throws IOException, InterruptedException { { final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourceReferencesQuery", new HashSet<ValueIndexTerm>(), 0, -1 ); try { service.query( request ); fail(); } catch ( IllegalArgumentException e ) { e.printStackTrace(); assertTrue( "Unexpected message: " + e.getMessage(), e.getMessage().startsWith("Expected 'ref:*' term was not found" ) ); // and Swallow. Expected } } }
@Test public void testQueryInvalidIndexTerms() throws IOException, InterruptedException { { final RefactoringPageRequest request = new RefactoringPageRequest("FindRulesByModuleQuery", new HashSet<ValueIndexTerm>(), 0, -1); try { service.query(request); fail(); } catch (IllegalArgumentException e) { assertTrue("Unexpected exception: " + e.getMessage(), e.getMessage().startsWith("Expected '" + ValuePackageNameIndexTerm.TERM + "' term was not found")); // and Swallow. Expected } } }
private PageResponse<RefactoringPageRow> queryBPMN2Resources() throws IllegalArgumentException { final RefactoringPageRequest request = new RefactoringPageRequest(FindResourcesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new ValueResourceIndexTerm("*", ResourceType.BPMN2, ValueIndexTerm.TermSearchType.WILDCARD)); }}, 0, 10); return service.query(request); }
private PageResponse<RefactoringPageRow> getFormResources() throws IllegalArgumentException { final RefactoringPageRequest request = new RefactoringPageRequest(FindResourcesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new ValueResourceIndexTerm("*", ResourceType.FORM, ValueIndexTerm.TermSearchType.WILDCARD)); }}, 0, 10); return service.query(request); }
final PageResponse<RefactoringPageRow> findRulesByProjectQuery = refactoringQueryService.query(new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, queryTerms, query.getStartIndex(),
@Test public void testFindResourcesQueryInvalidIndexTerms() throws IOException, InterruptedException { final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", new HashSet<ValueIndexTerm>(), 0, final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( "myRule", ResourceType.RULE ) ); final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( "org.kie.workbench.common.services.refactoring.backend.server.drl.classes.Applicant", ResourceType.JAVA ) );
@Test public void testFindResourcePartReferencesQueryInvalidIndexTerms() throws IOException, InterruptedException { final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartReferencesQuery.NAME, new HashSet<ValueIndexTerm>(), 0, final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( "myRule", ResourceType.RULE ) ); final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( "org.kie.workbench.common.services.refactoring.backend.server.drl.classes.Applicant", ResourceType.JAVA ) );
@Test public void testFindResourcePartsQueryInvalidIndexTerms() throws IOException, InterruptedException { final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcePartsQuery", new HashSet<ValueIndexTerm>(), 0, final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcePartsQuery", new HashSet<ValueIndexTerm>() {{ add( ruleRefTerm ); final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcePartsQuery", new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( "org.kie.workbench.common.services.refactoring.backend.server.drl.classes.Applicant", ResourceType.JAVA ) );
@Test public void listAllInProjectSorted() throws IOException, InterruptedException { setUp(TEST_PROJECT_ROOT1); final RefactoringPageRequest request = new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new LibraryValueRepositoryRootIndexTerm(getRepositoryRootPath(), TermSearchType.NORMAL)); }}, 0, 10); final PageResponse<RefactoringPageRow> response = service.query(request); assertNotNull(response); // Remove duplicates and sort file names alphabetically Set<String> resultSet = new TreeSet<>(); for (RefactoringPageRow row : response.getPageRowList()) { String fileName = ((Path) row.getValue()).getFileName(); System.out.println(fileName); resultSet.add(fileName); } assertArrayEquals("Observed: " + resultSet, FILE_NAMES, resultSet.toArray()); }
setUp(TEST_PROJECT_ROOT1); final RefactoringPageRequest request1 = new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new LibraryValueRepositoryRootIndexTerm(getRepositoryRootPath(), resultSet1.toArray()); final RefactoringPageRequest request2 = new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new LibraryValueRepositoryRootIndexTerm(getRepositoryRootPath(),
TermSearchType.WILDCARD ) ); final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", queryTerms, 0, final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", queryTerms, 0, final RefactoringPageRequest request = new RefactoringPageRequest( "FindResourcesQuery", queryTerms, 0,
final RefactoringPageRequest request = new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new LibraryValueRepositoryRootIndexTerm(getRepositoryRootPath(),
PartType.FIELD ) ); final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartsQuery.NAME, queryTerms, 0,
final RefactoringPageRequest request = new RefactoringPageRequest(FindAllLibraryAssetsQuery.NAME, new HashSet<ValueIndexTerm>() {{ add(new LibraryValueRepositoryRootIndexTerm(getRepositoryRootPath(),
final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueResourceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueResourceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueResourceIndexTerm(
final RefactoringPageRequest request = new RefactoringPageRequest( FindResourceReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourceReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourceReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourceReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourceReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueReferenceIndexTerm(
final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValuePartReferenceIndexTerm( final RefactoringPageRequest request = new RefactoringPageRequest( FindResourcePartReferencesQuery.NAME, new HashSet<ValueIndexTerm>() {{ add( new ValueSharedPartIndexTerm(