Examples of JsonTypeDefinition


Examples of org.codehaus.enunciate.contract.json.JsonTypeDefinition

          loadTypeDef(typeDef, model);
        }

        boolean jsonType = isPotentialJsonSchemaType(declaration);
        if (jsonType) {
          JsonTypeDefinition typeDefinition = JsonTypeDefinition.createTypeDefinition((ClassDeclaration) declaration);
          loadJsonTypeDef(typeDefinition, model);
        }

        if (!xmlType && !jsonType) {
          onUnhandledDeclaration(model, declaration);
View Full Code Here

Examples of org.codehaus.enunciate.contract.json.JsonTypeDefinition

    return null;
  }

  private JsonSchemaInfo jsonSchemaForType(final JsonType jsonType) {
    if (jsonType instanceof JsonTypeDefinition) {
      final JsonTypeDefinition jsonTypeDefinition = (JsonTypeDefinition) jsonType;
      final String schemaId = JsonSchemaInfo.schemaIdForType(jsonTypeDefinition.classDeclaration());
      return model.getIdsToJsonSchemas().get(schemaId);
    }
    return null;
  }
View Full Code Here

Examples of org.codehaus.enunciate.contract.json.JsonTypeDefinition

   */
  public void testAddJsonTypeDefinition()
  {
      EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
      FreemarkerModel.set(model);
      final JsonTypeDefinition nameTypeDefinition = JsonTypeDefinition.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.json.Name"));
      assertNull(model.findJsonTypeDefinition(nameTypeDefinition));
      model.addJsonType(nameTypeDefinition);
      assertNotNull(model.findJsonTypeDefinition(nameTypeDefinition));
      JsonSchemaInfo jsonSchemaInfo = model.getIdsToJsonSchemas().get(JsonSchemaInfo.schemaIdForType(nameTypeDefinition));
      assertNotNull(jsonSchemaInfo);
      assertNotNull(jsonSchemaInfo.getTypesByName().get(nameTypeDefinition.getTypeName()));
      assertNull(jsonSchemaInfo.getTopLevelTypesByName().get(nameTypeDefinition.getTypeName()));
  }
View Full Code Here

Examples of org.codehaus.enunciate.contract.json.JsonTypeDefinition

  public void testAddJsonRootElement()
  {
      EnunciateFreemarkerModel model = new EnunciateFreemarkerModel();
      FreemarkerModel.set(model);

      final JsonTypeDefinition nameTypeDefinition = JsonTypeDefinition.createTypeDefinition((ClassDeclaration) getDeclaration("org.codehaus.enunciate.samples.json.Name"));
      final JsonRootElementDeclaration rootElementDeclaration = new JsonRootElementDeclaration(nameTypeDefinition);

      assertNull(model.findJsonRootElementDeclaration(rootElementDeclaration));
      model.addJsonRootElement(rootElementDeclaration);
      assertNotNull(model.findJsonRootElementDeclaration(rootElementDeclaration));
      assertNotNull(model.findJsonTypeDefinition(nameTypeDefinition));

      JsonSchemaInfo jsonSchemaInfo = model.getIdsToJsonSchemas().get(JsonSchemaInfo.schemaIdForType(nameTypeDefinition));
      assertNotNull(jsonSchemaInfo);
      assertNotNull(jsonSchemaInfo.getTypesByName().get(nameTypeDefinition.getTypeName()));
      assertNotNull(jsonSchemaInfo.getTopLevelTypesByName().get(nameTypeDefinition.getTypeName()));
  }
View Full Code Here

Examples of voldemort.serialization.json.JsonTypeDefinition

                    if(remoteKeySerializerDef.getName().equals("json")
                       && remoteValueSerializerDef.getName().equals("json")
                       && remoteKeySerializerDef.getAllSchemaInfoVersions().size() == 1
                       && remoteValueSerializerDef.getAllSchemaInfoVersions().size() == 1) {
                        JsonTypeDefinition remoteKeyDef = JsonTypeDefinition.fromJson(remoteKeySerializerDef.getCurrentSchemaInfo());
                        JsonTypeDefinition remoteValDef = JsonTypeDefinition.fromJson(remoteValueSerializerDef.getCurrentSchemaInfo());
                        JsonTypeDefinition localKeyDef = JsonTypeDefinition.fromJson(localKeySerializerDef.getCurrentSchemaInfo());
                        JsonTypeDefinition localValDef = JsonTypeDefinition.fromJson(localValueSerializerDef.getCurrentSchemaInfo());

                        if(remoteKeyDef.equals(localKeyDef) && remoteValDef.equals(localValDef)) {
                            // if the key/value serializers are REALLY equal
                            // (even though the strings may not match), then
                            // just use the remote stores to GUARANTEE that they
View Full Code Here

Examples of voldemort.serialization.json.JsonTypeDefinition

                        if(remoteKeySerializerDef.getName().equals("json")
                           && remoteValueSerializerDef.getName().equals("json")
                           && remoteKeySerializerDef.getAllSchemaInfoVersions().size() == 1
                           && remoteValueSerializerDef.getAllSchemaInfoVersions().size() == 1) {
                            JsonTypeDefinition remoteKeyDef = JsonTypeDefinition.fromJson(remoteKeySerializerDef.getCurrentSchemaInfo());
                            JsonTypeDefinition remoteValDef = JsonTypeDefinition.fromJson(remoteValueSerializerDef.getCurrentSchemaInfo());
                            JsonTypeDefinition localKeyDef = JsonTypeDefinition.fromJson(localKeySerializerDef.getCurrentSchemaInfo());
                            JsonTypeDefinition localValDef = JsonTypeDefinition.fromJson(localValueSerializerDef.getCurrentSchemaInfo());

                            if(remoteKeyDef.equals(localKeyDef) && remoteValDef.equals(localValDef)) {
                                String compressionPolicy = "";
                                if(hasCompression) {
                                    compressionPolicy = "\n\t\t<compression><type>gzip</type></compression>";
View Full Code Here

Examples of voldemort.serialization.json.JsonTypeDefinition

import voldemort.serialization.json.JsonTypeSerializer;

public class TestSerialization {

    public static void main(String[] args) {
        JsonTypeDefinition def = JsonTypeDefinition.fromJson("[\"int32\"]");
        int size = 30000;
        List<Integer> value = new ArrayList<Integer>(size);
        for(int i = 0; i < size; i++)
            value.add(i);
        JsonTypeSerializer ser = new JsonTypeSerializer(def);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.