Search in sources :

Example 6 with AllowList

use of org.kie.workbench.common.services.shared.allowlist.AllowList in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testAllowListSave.

@Test
public void testAllowListSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final AllowList allowList = new AllowList();
    model.setAllowList(allowList);
    final Path pathToAllowList = mock(Path.class);
    model.setPathToAllowList(pathToAllowList);
    final Metadata metadata = new Metadata();
    model.setAllowListMetaData(metadata);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message allow list");
    verify(allowListService).save(eq(pathToAllowList), eq(allowList), eq(metadata), eq("message allow list"));
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) MavenRepositoryMetadata(org.guvnor.common.services.project.model.MavenRepositoryMetadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) AllowList(org.kie.workbench.common.services.shared.allowlist.AllowList) Test(org.junit.Test)

Example 7 with AllowList

use of org.kie.workbench.common.services.shared.allowlist.AllowList in project kie-wb-common by kiegroup.

the class PackageNameAllowListServiceImplTest method testSave.

@Test
public void testSave() throws Exception {
    final PackageNameAllowListService service = makeService("");
    final Path path = mock(Path.class);
    final AllowList allowList = new AllowList();
    final Metadata metadata = new Metadata();
    final String comment = "comment";
    service.save(path, allowList, metadata, comment);
    verify(saver).save(path, allowList, metadata, comment);
}
Also used : Path(org.uberfire.backend.vfs.Path) PackageNameAllowListService(org.kie.workbench.common.services.shared.allowlist.PackageNameAllowListService) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) AllowList(org.kie.workbench.common.services.shared.allowlist.AllowList) Test(org.junit.Test)

Example 8 with AllowList

use of org.kie.workbench.common.services.shared.allowlist.AllowList in project kie-wb-common by kiegroup.

the class ClassVerifierTest method testVerifyClass.

@Test
public void testVerifyClass() {
    AllowList allowList = new AllowList();
    allowList.add("org.kie.workbench.common.services.backend.builder");
    ClassVerifier classVerifier = new ClassVerifier(kieModuleMetaData, typeSourceResolver);
    List<BuildMessage> messages = classVerifier.verify(allowList);
    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());
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage) AllowList(org.kie.workbench.common.services.shared.allowlist.AllowList) Test(org.junit.Test)

Example 9 with AllowList

use of org.kie.workbench.common.services.shared.allowlist.AllowList in project kie-wb-common by kiegroup.

the class DependenciesPresenterTest method testAddAllToAllowList.

@Test
public void testAddAllToAllowList() {
    dependenciesPresenter.model = mock(ProjectScreenModel.class);
    doReturn(new AllowList()).when(dependenciesPresenter.model).getAllowList();
    assertEquals(0, dependenciesPresenter.model.getAllowList().size());
    dependenciesPresenter.addAllToAllowList(new HashSet<>(Arrays.asList("foo", "bar")));
    assertEquals(2, dependenciesPresenter.model.getAllowList().size());
    verify(enhancedDependenciesManager).update();
}
Also used : ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) AllowList(org.kie.workbench.common.services.shared.allowlist.AllowList) Test(org.junit.Test)

Example 10 with AllowList

use of org.kie.workbench.common.services.shared.allowlist.AllowList in project kie-wb-common by kiegroup.

the class DependenciesItemPresenterTest method testSetupNormal.

@Test
public void testSetupNormal() {
    dependenciesItemPresenter.setup(new NormalEnhancedDependency(mock(Dependency.class), emptySet()), new AllowList(), mock(DependenciesPresenter.class));
    verify(view).init(any());
    verify(view).setGroupId(any());
    verify(view).setArtifactId(any());
    verify(view).setVersion(any());
    verify(view).setPackagesAllowListedState(any());
    verify(view).setTransitiveDependency(eq(false));
}
Also used : AllowList(org.kie.workbench.common.services.shared.allowlist.AllowList) NormalEnhancedDependency(org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency) Test(org.junit.Test)

Aggregations

AllowList (org.kie.workbench.common.services.shared.allowlist.AllowList)12 Test (org.junit.Test)11 ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)5 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)4 Path (org.uberfire.backend.vfs.Path)3 HashMap (java.util.HashMap)2 PackageNameAllowListService (org.kie.workbench.common.services.shared.allowlist.PackageNameAllowListService)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 BuildMessage (org.guvnor.common.services.project.builder.model.BuildMessage)1 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)1 NormalEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.NormalEnhancedDependency)1 TransitiveEnhancedDependency (org.kie.workbench.common.services.shared.dependencies.TransitiveEnhancedDependency)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)1