Author: rareddy
Date: 2009-07-14 16:26:44 -0400 (Tue, 14 Jul 2009)
New Revision: 1129
Added:
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
trunk/test-integration/src/test/resources/authcheck/
trunk/test-integration/src/test/resources/authcheck/bqt.def
trunk/test-integration/src/test/resources/authcheck/bqt.properties
trunk/test-integration/src/test/resources/authcheck/bqt.vdb
trunk/test-integration/src/test/resources/authcheck/groups.properties
trunk/test-integration/src/test/resources/authcheck/membership-file.properties
trunk/test-integration/src/test/resources/authcheck/users.properties
Log:
TEIID-665: Integration test to check entitlements
Added:
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
===================================================================
---
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
(rev 0)
+++
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java 2009-07-14
20:26:44 UTC (rev 1129)
@@ -0,0 +1,63 @@
+package com.metamatrix.server.integration;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.jdbc.api.AbstractMMQueryTestCase;
+
+public class TestDataEntitlements extends AbstractMMQueryTestCase {
+
+ private static final String DQP_PROP_FILE = UnitTestUtil.getTestDataPath() +
"/authcheck/bqt.properties;"; //$NON-NLS-1$
+ private static final String VDB = "bqt"; //$NON-NLS-1$
+
+ @Test public void testNoUserAuth() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=test"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+ }
+
+ @Test public void testAdminAuth() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=admin;password=mm"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+
+ getConnection(VDB, DQP_PROP_FILE, "user=admin;password=teiid");
//$NON-NLS-1$
+ execute("select * from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ }
+
+ @Test public void testEntitlements() {
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=john;password=foo"); //$NON-NLS-1$
+ TestCase.fail("Should have failed authenticate user test"); //$NON-NLS-1$
+ } catch (Exception e) {
+ }
+
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=john;password=mm"); //$NON-NLS-1$
+ execute("select intkey, stringkey from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ } catch(Exception e) {
+ TestCase.assertTrue(e.getMessage().endsWith("is not entitled to action
<Read> for 1 or more of the groups/elements/procedures.")); //$NON-NLS-1$
+ }
+
+ getConnection(VDB, DQP_PROP_FILE, "user=paul;password=mm"); //$NON-NLS-1$
+ execute("select intkey, stringkey from BQT1.smalla"); //$NON-NLS-1$
+ assertRowCount(50);
+
+ try {
+ getConnection(VDB, DQP_PROP_FILE, "user=paul;password=mm"); //$NON-NLS-1$
+ execute("select * from BQT1.smalla"); //$NON-NLS-1$
+ walkResults();
+ } catch(Exception e) {
+ TestCase.assertTrue(e.getMessage().endsWith("is not entitled to action
<Read> for 1 or more of the groups/elements/procedures.")); //$NON-NLS-1$
+ }
+ }
+
+}
Property changes on:
trunk/test-integration/src/test/java/com/metamatrix/server/integration/TestDataEntitlements.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/bqt.def
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/bqt.def
(rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/bqt.def 2009-07-14 20:26:44 UTC
(rev 1129)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<VDB>
+ <VDBInfo>
+ <Property Name="Name" Value="BQT" />
+ <Property Name="Version" Value="1" />
+ <Property Name="VDBArchiveName" Value="bqt.vdb" />
+ <Property Name="Description" Value="" />
+ <Property Name="IsActive" Value="true" />
+ </VDBInfo>
+ <Model>
+ <Property Name="Name" Value="XQT" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="VQT" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="BQT2" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTRecursiveDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="XQTNestedDoc" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ </Model>
+ <Model>
+ <Property Name="Name" Value="SP" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <Model>
+ <Property Name="Name" Value="BQT1" />
+ <Property Name="Visibility" Value="Public" />
+ <Property Name="MultiSourceEnabled" Value="false" />
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" />
+ </ConnectorBindings>
+ </Model>
+ <ConnectorBindings>
+ <Connector Name="Derby Connector" ComponentType="Apache Derby
Embedded Connector">
+ <Properties>
+ <Property Name="Immutable">true</Property>
+ <Property
Name="URL">jdbc:derby:jar:(src/test/resources/derby/sample.zip)bqt</Property>
+ </Properties>
+ </Connector>
+ </ConnectorBindings>
+</VDB>
+
Added: trunk/test-integration/src/test/resources/authcheck/bqt.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/bqt.properties
(rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/bqt.properties 2009-07-14 20:26:44
UTC (rev 1129)
@@ -0,0 +1,41 @@
+#
+# JBoss, Home of Professional Open Source.
+# See the COPYRIGHT.txt file distributed with this work for information
+# regarding copyright ownership. Some portions may be licensed
+# to Red Hat, Inc. under one or more contributor license agreements.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA.
+#
+
+dqp.configFile=../ServerConfig.xml
+vdb.definition=./bqt.def
+
+#only for testing, as this takes more time to start and shutdown
+metamatrix.xatxnmgr.enable_recovery=false
+
+membership.enabled=true
+membership.superUser=admin
+membership.superUserPassword=teiid
+membership.DomainOrder=file
+
+# File Membership Domain Settings (activate, Membership Domain Class Name, Property file
for configuration)
+file.activate=true
+file.AuthDomainClass=com.metamatrix.platform.security.membership.spi.file.FileMembershipDomain
+file.propertiesFile=membership-file.properties
+
+entitlements.enabled=true
+
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/bqt.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/bqt.vdb
===================================================================
(Binary files differ)
Property changes on: trunk/test-integration/src/test/resources/authcheck/bqt.vdb
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/test-integration/src/test/resources/authcheck/groups.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/groups.properties
(rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/groups.properties 2009-07-14
20:26:44 UTC (rev 1129)
@@ -0,0 +1,2 @@
+group1=paul
+
Property changes on:
trunk/test-integration/src/test/resources/authcheck/groups.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/membership-file.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/membership-file.properties
(rev 0)
+++
trunk/test-integration/src/test/resources/authcheck/membership-file.properties 2009-07-14
20:26:44 UTC (rev 1129)
@@ -0,0 +1,11 @@
+#File based membership domain configuration properties
+
+#Location of the properties file containing user name and password entries.
+usersFile=users.properties
+
+#Location of the properties file containing group assignments
+groupsFile=groups.properties
+
+#Check passwords against the users file.
+checkPassword=true
+
Property changes on:
trunk/test-integration/src/test/resources/authcheck/membership-file.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/test-integration/src/test/resources/authcheck/users.properties
===================================================================
--- trunk/test-integration/src/test/resources/authcheck/users.properties
(rev 0)
+++ trunk/test-integration/src/test/resources/authcheck/users.properties 2009-07-14
20:26:44 UTC (rev 1129)
@@ -0,0 +1,3 @@
+john=mm
+paul=mm
+
Property changes on: trunk/test-integration/src/test/resources/authcheck/users.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Show replies by date