本文整理汇总了Java中com.redhat.lightblue.metadata.types.DefaultTypes类的典型用法代码示例。如果您正苦于以下问题:Java DefaultTypes类的具体用法?Java DefaultTypes怎么用?Java DefaultTypes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultTypes类属于com.redhat.lightblue.metadata.types包,在下文中一共展示了DefaultTypes类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMd
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
public EntityMetadata getMd(String fname) {
//runValidJsonTest("json-schema/metadata/metadata.json", fname);
try {
JsonNode node = loadJsonNode(fname);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new MongoDataStoreParser<JsonNode>());
TypeResolver resolver = new DefaultTypes();
JSONMetadataParser parser = new JSONMetadataParser(extensions, resolver, nodeFactory);
EntityMetadata md = parser.parseEntityMetadata(node);
PredefinedFields.ensurePredefinedFields(md);
return md;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:17,代码来源:AbstractMongoCrudTest.java
示例2: setup
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Before
public void setup() throws Exception {
Factory factory = new Factory();
factory.addCRUDController("mongo", new TestCRUDController());
Extensions<Object> x = new Extensions<>();
x.addDefaultExtensions();
x.registerDataStoreParser("mongo", new MongoDataStoreParser<Object>());
// 50 msecs version lookup
// 100 msecs cache refresh
cache.setCacheParams(50l, 100l);
db = mongo.getConnection().getDB("mongo");
md = new MongoMetadata(db, x, new DefaultTypes(), factory, cache);
BasicDBObject index = new BasicDBObject("name", 1);
index.put("version.value", 1);
db.getCollection(MongoMetadata.DEFAULT_METADATA_COLLECTION).createIndex(index, "name", true);
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:17,代码来源:CacheTest.java
示例3: createMetadataWithPartialFilterExpression_CanPersistFieldNamesWithDots
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void createMetadataWithPartialFilterExpression_CanPersistFieldNamesWithDots() throws Exception {
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new MongoDataStoreParser<JsonNode>());
JSONMetadataParser parser = new JSONMetadataParser(extensions, new DefaultTypes(), new JsonNodeFactory(true));
EntityMetadata m = parser.parseEntityMetadata(AbstractJsonNodeTest.loadJsonNode("./testMetadata_partialIndex.json"));
Index partialIndex = m.getEntityInfo().getIndexes().getIndexes().get(0);
Assert.assertEquals("{$and=[{field6.nf7.nnf2={$gt=5}}, {field6.nf7.nnf2={$lt=100}}]}", partialIndex.getProperties().get("partialFilterExpression").toString());
// persist
md.createNewMetadata(m);
// read
m = md.getEntityMetadata("test", "1.0.0");
Assert.assertNotNull(m);
partialIndex = m.getEntityInfo().getIndexes().getIndexes().get(0);
Assert.assertEquals("{ \"$and\" : [ { \"field6.nf7.nnf2\" : { \"$gt\" : 5}} , { \"field6.nf7.nnf2\" : { \"$lt\" : 100}}]}", partialIndex.getProperties().get("partialFilterExpression").toString());
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:22,代码来源:MongoMetadataTest.java
示例4: createMdWithAndRefTest
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void createMdWithAndRefTest() throws Exception {
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
extensions.registerDataStoreParser("mongo", new MongoDataStoreParser<JsonNode>());
JSONMetadataParser parser = new JSONMetadataParser(extensions, new DefaultTypes(), new JsonNodeFactory(true));
// get JsonNode representing metadata
JsonNode jsonMetadata = AbstractJsonNodeTest.loadJsonNode(getClass().getSimpleName() + "-qps-andquery.json");
// parser into EntityMetadata
EntityMetadata e = parser.parseEntityMetadata(jsonMetadata);
// persist
md.createNewMetadata(e);
EntityMetadata g = md.getEntityMetadata("test", "1.0.0");
// No exception=OK
}
开发者ID:lightblue-platform,项目名称:lightblue-mongo,代码行数:19,代码来源:MongoMetadataTest.java
示例5: testConvert
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testConvert() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-fetch.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
MetadataParser<JsonNode> p2 = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
new RDBMSPropertyParserImpl<JsonNode>().convert(p2, node, rdbms);
assertNotNull(p2.getObjectProperty(node, "rdbms"));
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:21,代码来源:RDBMSPropertyParserImplTest.java
示例6: testParse_NoDialect
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_NoDialect() throws IOException{
expectedEx.expect(com.redhat.lightblue.util.Error.class);
expectedEx.expectMessage("{\"objectType\":\"error\",\"errorCode\":\""
+ RDBMSConstants.ERR_FIELD_REQUIRED
+ "\",\"msg\":\"No field informed\"}");
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode emptyNode = JsonUtils.json("{}");
new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, emptyNode);
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:17,代码来源:RDBMSPropertyParserImplTest.java
示例7: testParse_EmptyDialect
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_EmptyDialect() throws IOException{
expectedEx.expect(com.redhat.lightblue.util.Error.class);
expectedEx.expectMessage("{\"objectType\":\"error\",\"errorCode\":\""
+ RDBMSConstants.ERR_FIELD_REQUIRED
+ "\",\"msg\":\"No field informed\"}");
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode emptyNode = JsonUtils.json("{\"dialect\":\"\"}");
new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, emptyNode);
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:17,代码来源:RDBMSPropertyParserImplTest.java
示例8: testParse_NoOperation
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_NoOperation() throws IOException{
expectedEx.expect(com.redhat.lightblue.util.Error.class);
expectedEx.expectMessage("{\"objectType\":\"error\",\"errorCode\":\""
+ RDBMSConstants.ERR_FIELD_REQUIRED
+ "\",\"msg\":\"No Operation informed\"}");
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode emptyNode = JsonUtils.json("{\"dialect\":\""+ DialectOperators.ORACLE + "\"}");
new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, emptyNode);
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:17,代码来源:RDBMSPropertyParserImplTest.java
示例9: testParse_Delete
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_Delete() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-delete.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
assertEquals(DialectOperators.ORACLE, rdbms.getDialect());
assertNotNull(rdbms.getDelete());
assertNull(rdbms.getFetch());
assertNull(rdbms.getInsert());
assertNull(rdbms.getSave());
assertNull(rdbms.getUpdate());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:19,代码来源:RDBMSPropertyParserImplTest.java
示例10: testParse_Fetch
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_Fetch() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-fetch.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
assertEquals(DialectOperators.ORACLE, rdbms.getDialect());
assertNull(rdbms.getDelete());
assertNotNull(rdbms.getFetch());
assertNull(rdbms.getInsert());
assertNull(rdbms.getSave());
assertNull(rdbms.getUpdate());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:19,代码来源:RDBMSPropertyParserImplTest.java
示例11: testParse_Insert
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_Insert() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-insert.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
assertEquals(DialectOperators.ORACLE, rdbms.getDialect());
assertNull(rdbms.getDelete());
assertNull(rdbms.getFetch());
assertNotNull(rdbms.getInsert());
assertNull(rdbms.getSave());
assertNull(rdbms.getUpdate());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:19,代码来源:RDBMSPropertyParserImplTest.java
示例12: testParse_Save
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_Save() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-save.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
assertEquals(DialectOperators.ORACLE, rdbms.getDialect());
assertNull(rdbms.getDelete());
assertNull(rdbms.getFetch());
assertNull(rdbms.getInsert());
assertNotNull(rdbms.getSave());
assertNull(rdbms.getUpdate());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:19,代码来源:RDBMSPropertyParserImplTest.java
示例13: testParse_Update
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse_Update() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = loadJsonNode("RdbmsMetadataTest-update.json");
RDBMS rdbms = new RDBMSPropertyParserImpl<JsonNode>().parse(RDBMSPropertyParserImpl.NAME, p, node.get("rdbms"));
assertEquals(DialectOperators.ORACLE, rdbms.getDialect());
assertNull(rdbms.getDelete());
assertNull(rdbms.getFetch());
assertNull(rdbms.getInsert());
assertNull(rdbms.getSave());
assertNotNull(rdbms.getUpdate());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:19,代码来源:RDBMSPropertyParserImplTest.java
示例14: testParse
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testParse() throws IOException{
String databaseName = "fakeDatabase";
String datasourceName = "fakeDatasource";
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode node = JsonUtils.json("{\"database\":\"" + databaseName + "\",\"datasource\":\"" + datasourceName + "\"}");
RDBMSDataStore ds = new RDBMSDataStoreParser<JsonNode>().parse(RDBMSDataStoreParser.NAME, p, node);
assertNotNull(ds);
assertEquals(databaseName, ds.getDatabaseName());
assertEquals(datasourceName, ds.getDatasourceName());
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:18,代码来源:RDBMSDataStoreParserTest.java
示例15: testConvert
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testConvert() throws IOException{
String databaseName = "fakeDatabase";
String datasourceName = "fakeDatasource";
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode emptyNode = JsonUtils.json("{}");
RDBMSDataStore ds = new RDBMSDataStore(databaseName, datasourceName);
new RDBMSDataStoreParser<JsonNode>().convert(p, emptyNode, ds);
assertEquals(databaseName, p.getStringProperty(emptyNode, "database"));
assertEquals(datasourceName, p.getStringProperty(emptyNode, "datasource"));
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:20,代码来源:RDBMSDataStoreParserTest.java
示例16: testConvert_WithNullValues
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void testConvert_WithNullValues() throws IOException{
MetadataParser<JsonNode> p = new JSONMetadataParser(
new Extensions<JsonNode>(),
new DefaultTypes(),
new JsonNodeFactory(true));
JsonNode emptyNode = JsonUtils.json("{}");
RDBMSDataStore ds = new RDBMSDataStore(null, null);
new RDBMSDataStoreParser<JsonNode>().convert(p, emptyNode, ds);
assertNull(p.getStringProperty(emptyNode, "database"));
assertNull(p.getStringProperty(emptyNode, "datasource"));
}
开发者ID:lightblue-platform,项目名称:lightblue-rdbms,代码行数:17,代码来源:RDBMSDataStoreParserTest.java
示例17: hookTest
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void hookTest() throws Exception {
Extensions<JsonNode> ex = new Extensions<>();
HookTestCfgParser hookParser = new HookTestCfgParser();
ex.registerHookConfigurationParser("testHook", hookParser);
ex.registerDataStoreParser("test", new TestDataStoreParser());
JsonNode mdJson = json("{'name':'test','datastore':{'backend':'test' }, "
+ "'hooks':[ "
+ "{'name':'testHook','actions':['insert'],"
+ "'projection':{'field':'*','recursive':1},"
+ "'configuration':{'testField':'testValue'} } ] }");
JSONMetadataParser parser = new JSONMetadataParser(ex, new DefaultTypes(), nodeFactory);
EntityInfo ei = parser.parseEntityInfo(mdJson);
Assert.assertNotNull(ei);
Assert.assertFalse(ei.getHooks().isEmpty());
Assert.assertEquals("testHook", ei.getHooks().getHooks().get(0).getName());
Assert.assertTrue(ei.getHooks().getHooks().get(0).isInsert());
Assert.assertFalse(ei.getHooks().getHooks().get(0).isUpdate());
Assert.assertFalse(ei.getHooks().getHooks().get(0).isDelete());
Assert.assertEquals("testValue", ((TestHookCfg) ei.getHooks().getHooks().get(0).getConfiguration()).testName);
}
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:22,代码来源:ExtensionsTest.java
示例18: convertHookTest
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
@Test
public void convertHookTest() throws Exception {
Extensions<JsonNode> ex = new Extensions<>();
HookTestCfgParser hookParser = new HookTestCfgParser();
ex.registerHookConfigurationParser("testHook", hookParser);
ex.registerDataStoreParser("test", new TestDataStoreParser());
EntityInfo ei = new EntityInfo("test");
ArrayList<Hook> hooks = new ArrayList<>();
Hook hook = new Hook("testHook");
hook.setInsert(true);
hook.setProjection(new FieldProjection(new Path("*"), true, true));
hook.setConfiguration(new TestHookCfg("test"));
hooks.add(hook);
ei.getHooks().setHooks(hooks);
JSONMetadataParser parser = new JSONMetadataParser(ex, new DefaultTypes(), nodeFactory);
JsonNode node = parser.convert(ei);
System.out.println(node);
JSONAssert.assertEquals(node.toString(), json("{'name':'test','datastore':{'backend':'test' }, "
+ "'hooks':[ "
+ "{'name':'testHook','actions':['insert'],"
+ "'projection':{'field':'*','include':true,'recursive':true},"
+ "'configuration':{'testField':'test'} } ] }").toString(), false);
}
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:27,代码来源:ExtensionsTest.java
示例19: createJSONMetadataParser
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
/**
* Creates an instance of {@link JSONMetadataParser}.
*
* @param backend - Name of backend to use.
* @param fieldConstraintParsers - <i>(optional)</i>
* {@link FieldConstraintParser}s to register on the {@link Extensions} used
* to parse the {@link EntityMetadata}. If <code>null</code> then nothing
* will be set.
* @return An instance of {@link JSONMetadataParser}.
*/
public static JSONMetadataParser createJSONMetadataParser(
String backend,
Map<String, ? extends FieldConstraintParser<JsonNode>> fieldConstraintParsers) {
FakeDataStoreParser<JsonNode> dsParser = new FakeDataStoreParser<>(backend);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.registerDataStoreParser(dsParser.getDefaultName(), dsParser);
extensions.addDefaultExtensions();
if (fieldConstraintParsers != null) {
for (Entry<String, ? extends FieldConstraintParser<JsonNode>> checker : fieldConstraintParsers.entrySet()) {
extensions.registerFieldConstraintParser(checker.getKey(), checker.getValue());
}
}
return new JSONMetadataParser(
extensions,
new DefaultTypes(),
JsonNodeFactory.withExactBigDecimals(false));
}
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:30,代码来源:MetadataUtil.java
示例20: usingLightblueDefaults
import com.redhat.lightblue.metadata.types.DefaultTypes; //导入依赖的package包/类
public static Main usingLightblueDefaults() {
EntityNotificationHookConfigurationReader generator = new EntityNotificationHookConfigurationReader();
JsonNodeFactory factory = JsonNodeFactory.withExactBigDecimals(true);
Extensions<JsonNode> extensions = new Extensions<>();
extensions.addDefaultExtensions();
JSONMetadataParser parser = new JSONMetadataParser(extensions, new DefaultTypes(), factory);
return new Main(parser, prettyWriter, factory, generator);
}
开发者ID:esbtools,项目名称:lightblue-notification-hook,代码行数:10,代码来源:Main.java
注:本文中的com.redhat.lightblue.metadata.types.DefaultTypes类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论