Search in sources :

Example 41 with Procedure

use of org.voltdb.catalog.Procedure in project voltdb by VoltDB.

the class TestInvocationAcceptancePolicy method testAdHocReadUserPermission.

@Test
public void testAdHocReadUserPermission() {
    AuthSystem.AuthUser user = createUser(false, false, false, null, true, true, true);
    StoredProcedureInvocation invocation = new StoredProcedureInvocation();
    invocation.setProcName("@AdHoc_RO_MP");
    invocation.setParams("select * from T;");
    Procedure proc = SystemProcedureCatalog.listing.get("@AdHoc_RO_MP").asCatalogProcedure();
    InvocationPermissionPolicy policy = new InvocationSqlPermissionPolicy();
    assertEquals(policy.shouldAccept(user, invocation, proc), PolicyResult.ALLOW);
    // A user that doesn't have adhoc permission
    user = createUser(false, false, false, null, true, false, false);
    assertEquals(policy.shouldAccept(user, invocation, proc), PolicyResult.DENY);
}
Also used : Procedure(org.voltdb.catalog.Procedure) Test(org.junit.Test)

Example 42 with Procedure

use of org.voltdb.catalog.Procedure in project voltdb by VoltDB.

the class TestFragmentProgressUpdate method setUp.

@Override
protected void setUp() throws Exception {
    final int CLUSTER_ID = 2;
    final long NODE_ID = 1;
    super.setUp();
    VoltDB.instance().readBuildInfo("Test");
    m_warehousedata = new VoltTable(new VoltTable.ColumnInfo("W_ID", VoltType.SMALLINT), new VoltTable.ColumnInfo("W_NAME", VoltType.STRING), new VoltTable.ColumnInfo("W_STREET_1", VoltType.STRING), new VoltTable.ColumnInfo("W_STREET_2", VoltType.STRING), new VoltTable.ColumnInfo("W_CITY", VoltType.STRING), new VoltTable.ColumnInfo("W_STATE", VoltType.STRING), new VoltTable.ColumnInfo("W_ZIP", VoltType.STRING), new VoltTable.ColumnInfo("W_TAX", VoltType.FLOAT), new VoltTable.ColumnInfo("W_YTD", VoltType.FLOAT));
    m_itemData = new VoltTable(new VoltTable.ColumnInfo("I_ID", VoltType.INTEGER), new VoltTable.ColumnInfo("I_IM_ID", VoltType.INTEGER), new VoltTable.ColumnInfo("I_NAME", VoltType.STRING), new VoltTable.ColumnInfo("I_PRICE", VoltType.FLOAT), new VoltTable.ColumnInfo("I_DATA", VoltType.STRING));
    TPCCProjectBuilder builder = new TPCCProjectBuilder();
    m_catalog = builder.createTPCCSchemaCatalog();
    Cluster cluster = m_catalog.getClusters().get("cluster");
    WAREHOUSE_TABLEID = m_catalog.getClusters().get("cluster").getDatabases().get("database").getTables().get("WAREHOUSE").getRelativeIndex();
    ITEM_TABLEID = m_catalog.getClusters().get("cluster").getDatabases().get("database").getTables().get("ITEM").getRelativeIndex();
    CatalogMap<Procedure> procedures = cluster.getDatabases().get("database").getProcedures();
    m_testProc = procedures.getIgnoreCase("FragmentUpdateTestProcedure");
    m_ee = new ExecutionEngineJNI(CLUSTER_ID, NODE_ID, 0, 0, "", 0, 64 * 1024, 100, new HashinatorConfig(HashinatorType.LEGACY, LegacyHashinator.getConfigureBytes(1), 0, 0), false);
}
Also used : HashinatorConfig(org.voltdb.TheHashinator.HashinatorConfig) Cluster(org.voltdb.catalog.Cluster) Procedure(org.voltdb.catalog.Procedure) VoltTable(org.voltdb.VoltTable) TPCCProjectBuilder(org.voltdb.benchmark.tpcc.TPCCProjectBuilder)

Aggregations

Procedure (org.voltdb.catalog.Procedure)42 Statement (org.voltdb.catalog.Statement)12 Database (org.voltdb.catalog.Database)9 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Table (org.voltdb.catalog.Table)6 VoltTable (org.voltdb.VoltTable)5 Catalog (org.voltdb.catalog.Catalog)5 Constraint (org.voltdb.catalog.Constraint)5 ProcParameter (org.voltdb.catalog.ProcParameter)5 Config (org.voltdb.SystemProcedureCatalog.Config)4 ImmutableMap (com.google_voltpatches.common.collect.ImmutableMap)3 JSONException (org.json_voltpatches.JSONException)3 ProcInfoData (org.voltdb.ProcInfoData)3 SQLStmt (org.voltdb.SQLStmt)3 GroupRef (org.voltdb.catalog.GroupRef)3 PlanFragment (org.voltdb.catalog.PlanFragment)3 File (java.io.File)2 IOException (java.io.IOException)2 SimpleDateFormat (java.text.SimpleDateFormat)2