use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class DependenciesPresenterTest method testRemoveAllFromWhiteList.
@Test
public void testRemoveAllFromWhiteList() {
final Set<String> packages = new HashSet<>(Arrays.asList("foo", "bar"));
dependenciesPresenter.model = mock(ProjectScreenModel.class);
doReturn(new WhiteList(packages)).when(dependenciesPresenter.model).getWhiteList();
assertEquals(2, dependenciesPresenter.model.getWhiteList().size());
dependenciesPresenter.removeAllFromWhiteList(packages);
assertEquals(0, dependenciesPresenter.model.getWhiteList().size());
verify(enhancedDependenciesManager).update();
}
use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class DependenciesPresenterTest method testAddAllToWhiteList.
@Test
public void testAddAllToWhiteList() {
dependenciesPresenter.model = mock(ProjectScreenModel.class);
doReturn(new WhiteList()).when(dependenciesPresenter.model).getWhiteList();
assertEquals(0, dependenciesPresenter.model.getWhiteList().size());
dependenciesPresenter.addAllToWhiteList(new HashSet<>(Arrays.asList("foo", "bar")));
assertEquals(2, dependenciesPresenter.model.getWhiteList().size());
verify(enhancedDependenciesManager).update();
}
use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class ProjectScreenModelLoaderTest method testWhiteList.
@Test
public void testWhiteList() throws Exception {
final WhiteList whiteList = new WhiteList();
when(whiteListService.load(packageNamesWhiteListPath)).thenReturn(whiteList);
final Metadata metadata = new Metadata();
when(metadataService.getMetadata(packageNamesWhiteListPath)).thenReturn(metadata);
ProjectScreenModel model = loader.load(pathToPom);
assertEquals(packageNamesWhiteListPath, model.getPathToWhiteList());
assertEquals(whiteList, model.getWhiteList());
assertEquals(metadata, model.getWhiteListMetaData());
}
use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class ProjectScreenModelSaverTest method testWhiteListSave.
@Test
public void testWhiteListSave() throws Exception {
final ProjectScreenModel model = new ProjectScreenModel();
final WhiteList whiteList = new WhiteList();
model.setWhiteList(whiteList);
final Path pathToWhiteList = mock(Path.class);
model.setPathToWhiteList(pathToWhiteList);
final Metadata metadata = new Metadata();
model.setWhiteListMetaData(metadata);
saver.save(pathToPom, model, DeploymentMode.FORCED, "message white list");
verify(whiteListService).save(eq(pathToWhiteList), eq(whiteList), eq(metadata), eq("message white list"));
}
use of org.kie.workbench.common.services.shared.whitelist.WhiteList in project kie-wb-common by kiegroup.
the class PackageNameWhiteListFilter method getFilteredPackageNames.
/**
* @return Package Names matching the White List to the available packages
*/
public WhiteList getFilteredPackageNames() {
final WhiteList whiteList = new WhiteList();
final Map<String, String> packageNamePatterns = getPatterns();
for (String pattern : patterns) {
for (Map.Entry<String, String> packageNamePath : packageNamePatterns.entrySet()) {
if (ANT_PATH_MATCHER.match(pattern, packageNamePath.getValue())) {
whiteList.add(packageNamePath.getKey());
}
}
}
return whiteList;
}
Aggregations