本文整理汇总了Java中org.voltdb.utils.CatalogUtil.getSerializedCatalogStringFromJar方法的典型用法代码示例。如果您正苦于以下问题:Java CatalogUtil.getSerializedCatalogStringFromJar方法的具体用法?Java CatalogUtil.getSerializedCatalogStringFromJar怎么用?Java CatalogUtil.getSerializedCatalogStringFromJar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.voltdb.utils.CatalogUtil
的用法示例。
在下文中一共展示了CatalogUtil.getSerializedCatalogStringFromJar方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createSaveRestoreSchemaCatalog
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public Catalog createSaveRestoreSchemaCatalog() throws IOException
{
String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
String catalogJar = testDir + File.separator + "saverestore-jni.jar";
addAllDefaults();
boolean status = compile(catalogJar);
assert(status);
// read in the catalog
byte[] bytes = MiscUtils.fileToBytes(new File(catalogJar));
String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
assert(serializedCatalog != null);
// create the catalog (that will be passed to the ClientInterface
Catalog catalog = new Catalog();
catalog.execute(serializedCatalog);
return catalog;
}
示例2: catalogForJar
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
protected Catalog catalogForJar(String pathToJar) throws IOException {
byte[] bytes = MiscUtils.fileToBytes(new File(pathToJar));
String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
assertNotNull(serializedCatalog);
Catalog c = new Catalog();
c.execute(serializedCatalog);
return c;
}
示例3: testBadDDL
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
public void testBadDDL() throws IOException
{
// semicolons in in-lined comments are bad
VoltProjectBuilder builder = new VoltProjectBuilder();
builder.addLiteralSchema("CREATE TABLE A (C1 BIGINT NOT NULL, PRIMARY KEY(C1)); -- this; is bad");
builder.addPartitionInfo("A", "C1");
// semicolons in string literals are bad
builder.addLiteralSchema("create table t(id bigint not null, name varchar(5) default 'a;bc', primary key(id));");
builder.addPartitionInfo("t", "id");
// Add a newline string literal case just for fun
builder.addLiteralSchema("create table s(id bigint not null, name varchar(5) default 'a\nb', primary key(id));");
builder.addStmtProcedure("MakeCompileHappy",
"SELECT * FROM A WHERE C1 = ?;",
"A.C1: 0");
final File jar = new File("testbadddl-oop.jar");
jar.deleteOnExit();
builder.compile("testbadddl-oop.jar");
byte[] bytes = MiscUtils.fileToBytes(new File("testbadddl-oop.jar"));
String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
assertNotNull(serializedCatalog);
Catalog c = new Catalog();
c.execute(serializedCatalog);
CatalogContext context = new CatalogContext(0, 0, c, bytes, new byte[] {}, 0);
m_pt = new PlannerTool(context.cluster, context.database, context.getCatalogHash());
// Bad DDL would kill the planner before it starts and this query
// would return a Stream Closed error
m_pt.planSqlForTest("select * from A;");
}
示例4: setUp
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
// For planner-only testing, we shouldn't care about IV2
VoltDB.Configuration config = setUpSPDB();
byte[] bytes = MiscUtils.fileToBytes(new File(config.m_pathToCatalog));
String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
Catalog catalog = new Catalog();
catalog.execute(serializedCatalog);
CatalogContext context = new CatalogContext(0, 0, catalog, bytes, new byte[] {}, 0);
m_pt = new PlannerTool(context.cluster, context.database, context.getCatalogHash());
}
示例5: testCompileDeploymentAddUserToNonExistentGroup
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
/**
* ENG-7088: Validate that deployment file users that want to belong to roles which
* don't yet exist don't render the deployment file invalid.
*/
public void testCompileDeploymentAddUserToNonExistentGroup() throws IOException {
TPCCProjectBuilder project = new TPCCProjectBuilder();
project.addDefaultSchema();
project.addDefaultPartitioning();
project.addDefaultProcedures();
project.setSecurityEnabled(true, true);
RoleInfo groups[] = new RoleInfo[] {
new RoleInfo("foo", false, false, false, false, false, false),
new RoleInfo("blah", false, false, false, false, false, false)
};
project.addRoles(groups);
UserInfo users[] = new UserInfo[] {
new UserInfo("john", "hugg", new String[] {"foo"}),
new UserInfo("ryan", "betts", new String[] {"foo", "bar"}),
new UserInfo("ariel", "weisberg", new String[] {"bar"})
};
project.addUsers(users);
String testDir = BuildDirectoryUtils.getBuildDirectoryPath();
String jarName = "compile-deployment.jar";
String catalogJar = testDir + File.separator + jarName;
assertTrue("Project failed to compile", project.compile(catalogJar));
byte[] bytes = MiscUtils.fileToBytes(new File(catalogJar));
String serializedCatalog = CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
assertNotNull("Error loading catalog from jar", serializedCatalog);
Catalog catalog = new Catalog();
catalog.execute(serializedCatalog);
// this should succeed even though group "bar" does not exist
assertTrue("Deployment file should have been able to validate",
CatalogUtil.compileDeployment(catalog, project.getPathToDeployment(), true) == null);
}
示例6: buildCatalog
import org.voltdb.utils.CatalogUtil; //导入方法依赖的package包/类
private static void buildCatalog() throws IOException {
// build a real catalog
File cat = File.createTempFile("temp-log-reinitiator", "catalog");
cat.deleteOnExit();
VoltProjectBuilder builder = new VoltProjectBuilder();
String schema = "create table A (i integer not null, primary key (i));";
builder.addLiteralSchema(schema);
builder.addPartitionInfo("A", "i");
builder.addStmtProcedure("hello", "select * from A where i = ?", "A.i: 0");
if (!builder.compile(cat.getAbsolutePath())) {
throw new IOException();
}
byte[] bytes = MiscUtils.fileToBytes(cat);
String serializedCat =
CatalogUtil.getSerializedCatalogStringFromJar(CatalogUtil.loadAndUpgradeCatalogFromJar(bytes).getFirst());
assertNotNull(serializedCat);
Catalog catalog = new Catalog();
catalog.execute(serializedCat);
String deploymentPath = builder.getPathToDeployment();
CatalogUtil.compileDeployment(catalog, deploymentPath, false);
m_context = new CatalogContext(0, 0, catalog, bytes, new byte[] {}, 0);
TheHashinator.initialize(TheHashinator.getConfiguredHashinatorClass(), TheHashinator.getConfigureBytes(3));
}