Repository: incubator-sentry Updated Branches: refs/heads/db_policy_store 1e121ccca -> c40040e4c
http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c40040e4/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java ---------------------------------------------------------------------- diff --git a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java index fc01aaf..913e26a 100644 --- a/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java +++ b/sentry-provider/sentry-provider-db/src/test/java/org/apache/sentry/provider/db/service/thrift/TestSentryServiceIntegration.java @@ -9,7 +9,7 @@ * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software + * Unless createRequired 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 @@ -18,6 +18,9 @@ package org.apache.sentry.provider.db.service.thrift; import java.util.HashSet; +import com.google.common.base.Preconditions; + +import java.util.Set; import org.apache.sentry.service.thrift.Constants.ThriftConstants; import org.apache.sentry.service.thrift.SentryServiceIntegrationBase; @@ -29,18 +32,41 @@ public class TestSentryServiceIntegration extends SentryServiceIntegrationBase { private static final Logger LOGGER = LoggerFactory.getLogger(TestSentryServiceIntegration.class); @Test - public void testClientServerConnection() throws Exception { - TCreateSentryRoleRequest req = new TCreateSentryRoleRequest(); - req.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); + public void testCreateRole() throws Exception { + TDropSentryRoleRequest dropReq = new TDropSentryRoleRequest(); + dropReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); + dropReq.setRoleName("admin_r"); + dropReq.setUserName("user_1"); + TDropSentryRoleResponse dropResp = client.dropRole(dropReq); + assertOK(dropResp.getStatus()); + LOGGER.info("Successfully dropped role: admin_r"); + + TCreateSentryRoleRequest createReq = new TCreateSentryRoleRequest(); + createReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); + createReq.setUserName("user_1"); TSentryRole role = new TSentryRole(); role.setRoleName("admin_r"); role.setCreateTime(System.currentTimeMillis()); role.setGrantorPrincipal("test"); role.setPrivileges(new HashSet<TSentryPrivilege>()); - req.setUserName("admin"); - req.setRole(role); - TCreateSentryRoleResponse resp = client.createRole(req); - assertOK(resp.getStatus()); - LOGGER.info("Successfully opened connection"); + createReq.setRole(role); + TCreateSentryRoleResponse createResp = client.createRole(createReq); + assertOK(createResp.getStatus()); + LOGGER.info("Successfully create role: admin_r"); + + TListSentryRolesRequest listReq = new TListSentryRolesRequest(); + listReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); + listReq.setRoleName("admin_r"); + listReq.setUserName("user_1"); + TListSentryRolesResponse listResp = client.listRoleByName(listReq); + Set<TSentryRole> roles = listResp.getRoles(); + Preconditions.checkArgument(roles.size() == 1, "Incorrect number of roles"); + + dropReq.setProtocol_version(ThriftConstants.TSENTRY_SERVICE_VERSION_CURRENT); + dropReq.setRoleName("admin_r"); + dropReq.setUserName("user_1"); + dropResp = client.dropRole(dropReq); + assertOK(dropResp.getStatus()); + LOGGER.info("Successfully dropped role: admin_r"); } -} +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c40040e4/sentry-tests/sentry-tests-hive/.gitignore ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/.gitignore b/sentry-tests/sentry-tests-hive/.gitignore index 1f01ed7..a3e474e 100644 --- a/sentry-tests/sentry-tests-hive/.gitignore +++ b/sentry-tests/sentry-tests-hive/.gitignore @@ -1,3 +1,4 @@ derby.log TempStatsStore/** thirdparty/* +sentry_policy_db http://git-wip-us.apache.org/repos/asf/incubator-sentry/blob/c40040e4/sentry-tests/sentry-tests-hive/pom.xml ---------------------------------------------------------------------- diff --git a/sentry-tests/sentry-tests-hive/pom.xml b/sentry-tests/sentry-tests-hive/pom.xml index 1440015..2b00d16 100644 --- a/sentry-tests/sentry-tests-hive/pom.xml +++ b/sentry-tests/sentry-tests-hive/pom.xml @@ -272,6 +272,35 @@ limitations under the License. </executions> </plugin> </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <versionRange>[1.7,)</versionRange> + <goals> + <goal>run</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore></ignore> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> </build> <profiles> <profile>
