Sega76 commented on a change in pull request #6904: IGNITE-12220 URL: https://github.com/apache/ignite/pull/6904#discussion_r397844025
########## File path: modules/core/src/test/java/org/apache/ignite/internal/processors/security/rest/handlers/cache/CacheOperationPermissionRestCommandHandlerCheckTest.java ########## @@ -0,0 +1,410 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.security.rest.handlers.cache; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import org.apache.ignite.IgniteCheckedException; +import org.apache.ignite.configuration.IgniteConfiguration; +import org.apache.ignite.internal.IgniteEx; +import org.apache.ignite.internal.IgniteInternalFuture; +import org.apache.ignite.internal.processors.rest.GridRestCommand; +import org.apache.ignite.internal.processors.rest.GridRestResponse; +import org.apache.ignite.internal.processors.rest.handlers.GridRestCommandHandler; +import org.apache.ignite.internal.processors.rest.handlers.cache.GridCacheCommandHandler; +import org.apache.ignite.internal.processors.rest.request.GridRestCacheRequest; +import org.apache.ignite.internal.processors.rest.request.GridRestRequest; +import org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider; +import org.apache.ignite.plugin.security.SecurityPermission; +import org.apache.ignite.plugin.security.SecurityPermissionSetBuilder; +import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; +import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder; +import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest; +import org.apache.ignite.plugin.security.SecurityException; +import org.junit.Test; + +import static java.util.Collections.singletonMap; +import static org.apache.ignite.plugin.security.SecurityPermission.*; +import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause; + +/** + * Test CRUD, create and destroy cache permissions with rest commands handler. + */ +public class CacheOperationPermissionRestCommandHandlerCheckTest extends GridCommonAbstractTest { + /** Empty permission. */ + private static final SecurityPermission[] EMPTY_PERMS = new SecurityPermission[0]; + + /** Cache name for tests. */ + private static final String CACHE_NAME = "TEST_CACHE"; + + /** Forbidden cache. */ + private static final String FORBIDDEN_CACHE_NAME = "FORBIDDEN_TEST_CACHE"; + + /** New cache. */ + private static final String NEW_TEST_CACHE = "NEW_TEST_CACHE"; + + /** Key. */ + private String key = "key"; + + /** Value. */ + private String val = "value"; + + /** New value. */ + private String newVal = "newValue"; + + /** Cache permissions. */ + private Map<String, SecurityPermission[]> cachePerms = new HashMap<>(); + + /** Security permission set. */ + private Set<SecurityPermission> sysPermSet = new HashSet<>(); + + /** Handler. */ + private GridRestCommandHandler hnd; + + /** {@inheritDoc} */ + @Override protected IgniteConfiguration getConfiguration() throws Exception { + TcpDiscoverySpi disco = new TcpDiscoverySpi(); Review comment: done, thanks ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services