Package com.linkedin.data.schema

Examples of com.linkedin.data.schema.PrimitiveDataSchema


  @Test
  public void testPrimitiveSchema()
  {
    for (Map.Entry<DataSchema.Type, Class<?>> entry: _dataSchemaTypeToPrimitiveJavaTypeMap.entrySet())
    {
      final PrimitiveDataSchema schema = DataSchemaUtil.dataSchemaTypeToPrimitiveDataSchema(entry.getKey());
      final Object value = SchemaSampleDataGenerator.buildData(schema, _spec);
      Assert.assertSame(value.getClass(), entry.getValue());
    }

    final PrimitiveDataSchema nullSchema = DataSchemaConstants.NULL_DATA_SCHEMA;
    final Object nullData = SchemaSampleDataGenerator.buildData(nullSchema, _spec);
    Assert.assertEquals(nullData, Data.NULL);
  }
View Full Code Here


  @Test
  public void testArraySchema()
  {
    for (Map.Entry<DataSchema.Type, Class<? extends DirectArrayTemplate<?>>> entry: _dataSchemaTypeToprimitiveArrayMap.entrySet())
    {
      final PrimitiveDataSchema itemsSchema = DataSchemaUtil.dataSchemaTypeToPrimitiveDataSchema(entry.getKey());
      final ArrayDataSchema arraySchema = new ArrayDataSchema(itemsSchema);
      final DataList value = (DataList) SchemaSampleDataGenerator.buildData(arraySchema, _spec);
      final ParameterizedType arrayType = (ParameterizedType) entry.getValue().getGenericSuperclass();
      assert(arrayType.getRawType() == DirectArrayTemplate.class);
      Assert.assertSame(value.get(0).getClass(), arrayType.getActualTypeArguments()[0]);
View Full Code Here

  @Test
  public void testMapSchema()
  {
    for (Map.Entry<DataSchema.Type, Class<? extends DirectMapTemplate<?>>> entry: _dataSchemaTypeToprimitiveMapMap.entrySet())
    {
      final PrimitiveDataSchema valueSchema = DataSchemaUtil.dataSchemaTypeToPrimitiveDataSchema(entry.getKey());
      final MapDataSchema mapSchema = new MapDataSchema(valueSchema);
      final DataMap value = (DataMap) SchemaSampleDataGenerator.buildData(mapSchema, _spec);
      final ParameterizedType mapType = (ParameterizedType) entry.getValue().getGenericSuperclass();
      assert(mapType.getRawType() == DirectMapTemplate.class);
      Assert.assertSame(value.values().iterator().next().getClass(), mapType.getActualTypeArguments()[0]);
View Full Code Here

TOP

Related Classes of com.linkedin.data.schema.PrimitiveDataSchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.