本文整理了Java中org.kie.workbench.common.services.shared.whitelist.WhiteList
类的一些代码示例,展示了WhiteList
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhiteList
类的具体详情如下:
包路径:org.kie.workbench.common.services.shared.whitelist.WhiteList
类名称:WhiteList
暂无
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
public WhiteList load( final POM pom ) {
try {
return new WhiteList( packageNameSearchProvider.newTopLevelPackageNamesSearch( pom ).search() );
} catch ( NoBuilderFoundException e ) {
logger.info( "Could not create white list for project: " + pom.getGav().toString() );
return new WhiteList();
}
}
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
/**
* Filter the provided Package names by the Module's white list
* @param module Module for which to filter Package names
* @param packageNames All Package names in the Module
* @return A filtered collection of Package names
*/
@Override
public WhiteList filterPackageNames(final Module module,
final Collection<String> packageNames) {
if (packageNames == null) {
return new WhiteList();
} else if (module instanceof KieModule) {
final WhiteList whiteList = load(((KieModule) module).getPackageNamesWhiteListPath());
if (whiteList.isEmpty()) {
return new WhiteList(packageNames);
} else {
for (Package aPackage : moduleService.resolvePackages(module)) {
whiteList.add(aPackage.getPackageName());
}
return new PackageNameWhiteListFilter(packageNames,
whiteList).getFilteredPackageNames();
}
} else {
return new WhiteList(packageNames);
}
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-api
public boolean containsAny( final Collection<String> packages ) {
for ( String aPackage : packages ) {
if ( contains( aPackage ) ) {
return true;
}
}
return false;
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
/**
* @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;
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-api
@Test
public void testContainsAny() throws Exception {
final WhiteList whiteList = new WhiteList();
assertFalse( whiteList.containsAny( getSet() ) );
assertFalse( whiteList.containsAny( getSet( "org.test" ) ) );
whiteList.add( "org.something" );
assertFalse( whiteList.containsAny( getSet( "org.test" ) ) );
whiteList.add( "org.test" );
assertTrue( whiteList.containsAny( getSet( "org.test" ) ) );
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@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();
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Test
public void ifWhiteListIsEmptyWhiteListEverything() throws
Exception {
final PackageNameWhiteListService packageNameWhiteListService = makeService("");
WhiteList filterPackageNames = packageNameWhiteListService.filterPackageNames(mock(KieModule.class),
new ArrayList<String>
() {{
add("a");
add("b");
add("c");
}});
assertEquals(3,
filterPackageNames.size());
assertTrue(filterPackageNames.contains("a"));
assertTrue(filterPackageNames.contains("b"));
assertTrue(filterPackageNames.contains("c"));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
private void updateHashCode(final EnhancedDependencies enhancedDependencies) {
currentHashCode = enhancedDependencies.asList().hashCode() + model.getWhiteList().hashCode();
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Test
public void testNoFile() throws Exception {
tempFiles.deleteFiles();
assertTrue( loader.load( pathToWhiteList ).isEmpty() );
}
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
final WhiteList whiteList = new WhiteList();
whiteList.add( "org.drools" );
whiteList.add( "org.guvnor" );
final Metadata metadata = new Metadata();
final String comment = "comment";
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@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();
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-editor-api
result = 31 * result + (projectTagsMetaData != null ? projectTagsMetaData.hashCode() : 0);
result = ~~result;
result = 31 * result + (whiteList != null ? whiteList.hashCode() : 0);
result = ~~result;
result = 31 * result + (pathToWhiteList != null ? pathToWhiteList.hashCode() : 0);
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Override
public WhiteList load( final Path packageNamesWhiteListPath ) {
return new WhiteList( parsePackages( loadContent( packageNamesWhiteListPath ) ) );
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Test
public void testVerifyClass(){
WhiteList whiteList = new WhiteList();
whiteList.add("org.kie.workbench.common.services.backend.builder");
ClassVerifier classVerifier = new ClassVerifier(kieModuleMetaData, typeSourceResolver);
List<BuildMessage> messages = classVerifier.verify(whiteList);
assertEquals(messages.size(), 1);
assertEquals("Verification of class org.kie.workbench.common.services.backend.builder.SomeClass failed and will not be available for authoring.\n"
+ "Underlying system error is: The access to the class is not allowed. Please check the necessary external dependencies for this project are configured correctly.",
messages.get(0).getText());
}
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
public List<BuildMessage> verify(WhiteList whiteList) {
for (final String packageName : kieModuleMetaData.getPackages()) {
if (whiteList.contains(packageName)) {
for (final String className : kieModuleMetaData.getClasses(packageName)) {
verifyClass(packageName,
className);
}
}
}
return buildMessages;
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void testSetupNormal() {
dependenciesItemPresenter.setup(
new NormalEnhancedDependency(mock(Dependency.class), emptySet()),
new WhiteList(),
mock(DependenciesPresenter.class));
verify(view).init(any());
verify(view).setGroupId(any());
verify(view).setArtifactId(any());
verify(view).setVersion(any());
verify(view).setPackagesWhiteListedState(any());
verify(view).setTransitiveDependency(eq(false));
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-library-client
@Test
public void testSetupTransitive() {
dependenciesItemPresenter.setup(
new TransitiveEnhancedDependency(mock(Dependency.class), emptySet()),
new WhiteList(),
mock(DependenciesPresenter.class));
verify(view).init(any());
verify(view).setGroupId(any());
verify(view).setArtifactId(any());
verify(view).setVersion(any());
verify(view).setPackagesWhiteListedState(any());
verify(view).setTransitiveDependency(eq(true));
}
代码示例来源:origin: org.kie.workbench.services/kie-wb-common-services-backend
@Test
public void testSave() throws Exception {
final PackageNameWhiteListService service = makeService("");
final Path path = mock(Path.class);
final WhiteList whiteList = new WhiteList();
final Metadata metadata = new Metadata();
final String comment = "comment";
service.save(path,
whiteList,
metadata,
comment);
verify(saver).save(path,
whiteList,
metadata,
comment);
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-editor-backend
@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"));
}
}
代码示例来源:origin: org.kie.workbench.screens/kie-wb-common-project-editor-backend
@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());
}
内容来源于网络,如有侵权,请联系作者删除!