use of org.kie.workbench.common.services.refactoring.KPropertyImpl in project kie-wb-common by kiegroup.
the class GitKeepFileIndexerTest method testTheUsualBuild.
@Test
public void testTheUsualBuild() throws Exception {
final KieModule kieModule = mock(KieModule.class);
doReturn(kieModule).when(moduleService).resolveModule(any(Path.class));
doReturn("Module Name").when(kieModule).getModuleName();
doReturn(getPathMock("default://main@myRepository/Test")).when(kieModule).getRootPath();
final Package aPackage = mock(Package.class);
doReturn("pkgName").when(aPackage).getPackageName();
doReturn(aPackage).when(moduleService).resolvePackage(any(Path.class));
final IndexBuilder indexBuilder = indexer.fillIndexBuilder(mainPath);
final Set<KProperty<?>> properties = indexBuilder.build();
assertEquals(3, properties.size());
assertTrue(properties.contains(new KPropertyImpl<>(ModuleRootPathIndexTerm.TERM, "default://main@myRepository/Test")));
assertTrue(properties.contains(new KPropertyImpl<>(ModuleNameIndexTerm.TERM, "Module Name")));
assertTrue(properties.contains(new KPropertyImpl<>(PackageNameIndexTerm.TERM, "pkgName")));
}
use of org.kie.workbench.common.services.refactoring.KPropertyImpl in project kie-wb-common by kiegroup.
the class LibraryIndexer method fillIndexBuilder.
@Override
protected IndexBuilder fillIndexBuilder(final Path path) throws Exception {
// responsible for basic index info: file name, project root path
final String fileName = Paths.convert(path).getFileName();
final String repoRoot = getRootBackendPath(path);
final IndexBuilder builder = () -> {
final Set<KProperty<?>> indexElements = new HashSet<>();
indexElements.add(new KPropertyImpl<>(LibraryFileNameIndexTerm.TERM, fileName));
indexElements.add(new KPropertyImpl<>(FieldFactory.FILE_NAME_FIELD_SORTED, fileName.toLowerCase(), false, true));
indexElements.add(new KPropertyImpl<>(LibraryRepositoryRootIndexTerm.TERM, repoRoot));
return indexElements;
};
return builder;
}
Aggregations