Package com.google.gwt.core.ext

Examples of com.google.gwt.core.ext.GeneratorContext


      }
      writer.println("@Override");
      writer.println("public DateTimeFormatInfo getDateTimeFormatInfo() {");
      LocalizableGenerator localizableGenerator = new LocalizableGenerator();
      // Avoid warnings for trying to create the same type multiple times
      GeneratorContext subContext = new CachedGeneratorContext(context);
      generateConstantsLookup(logger, subContext, writer, localizableGenerator,
          runtimeLocales, localeUtils, locale,
          "com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl");
      writer.println("}");
      writer.println();
View Full Code Here


  public void testOutputCssMapArtifact() throws UnableToCompleteException {
    UnitTestTreeLogger testLogger = new UnitTestTreeLogger.Builder().createLogger();
    ResourceContext mockResourceContext = mock(ResourceContext.class);
    Map<JMethod, String> testMap = new HashMap<JMethod, String>();
    OutputStream mockOutputStream = mock(OutputStream.class);
    GeneratorContext mockGeneratorContext = mock(GeneratorContext.class);
    GeneratedResource mockGeneratedResource = mock(GeneratedResource.class);

    when(mockResourceContext.getGeneratorContext()).thenReturn(mockGeneratorContext);
    when(mockGeneratorContext.tryCreateResource(
        testLogger, "cssResource/com.test.Bundle.cssMethod.cssmap")).thenReturn(mockOutputStream);
    when(mockGeneratorContext.commitResource(testLogger, mockOutputStream)).thenReturn(
        mockGeneratedResource);

    JMethod method = mock(JMethod.class);
    JClassType bundleType = mock(JClassType.class);
    when(method.getEnclosingType()).thenReturn(bundleType);
View Full Code Here

    builder.expectWarn(
        "Could not create resource: cssResource/com.test.Bundle.cssMethod.cssmap", null);
    UnitTestTreeLogger testLogger =  builder.createLogger();
    ResourceContext mockResourceContext = mock(ResourceContext.class);
    Map<JMethod, String> testMap = new HashMap<JMethod, String>();
    GeneratorContext mockGeneratorContext = mock(GeneratorContext.class);

    when(mockResourceContext.getGeneratorContext()).thenReturn(mockGeneratorContext);
    when(mockGeneratorContext.tryCreateResource(testLogger,
        "cssResource/com.test.Bundle.cssMethod.cssmap")).thenThrow(new UnableToCompleteException());

    JMethod method = mock(JMethod.class);
    JClassType bundleType = mock(JClassType.class);
    when(method.getEnclosingType()).thenReturn(bundleType);
View Full Code Here

  public void testOutputCssMapArtifactReturnNullOutputString() throws UnableToCompleteException {
    UnitTestTreeLogger testLogger = new UnitTestTreeLogger.Builder().createLogger();
    ResourceContext mockResourceContext = mock(ResourceContext.class);
    Map<JMethod, String> testMap = new HashMap<JMethod, String>();
    GeneratorContext mockGeneratorContext = mock(GeneratorContext.class);

    when(mockResourceContext.getGeneratorContext()).thenReturn(mockGeneratorContext);
    when(mockGeneratorContext.tryCreateResource(
        testLogger, "cssResource/com.test.Bundle.cssMethod.cssmap")).thenReturn(null);

    JMethod method = mock(JMethod.class);
    JClassType bundleType = mock(JClassType.class);
    when(method.getEnclosingType()).thenReturn(bundleType);
View Full Code Here

        "Error trying to commit artifact: cssResource/com.test.Bundle.cssMethod.cssmap", null);
    UnitTestTreeLogger testLogger =  builder.createLogger();
    ResourceContext mockResourceContext = mock(ResourceContext.class);
    Map<JMethod, String> testMap = new HashMap<JMethod, String>();
    OutputStream mockOutputStream = mock(OutputStream.class);
    GeneratorContext mockGeneratorContext = mock(GeneratorContext.class);

    when(mockResourceContext.getGeneratorContext()).thenReturn(mockGeneratorContext);
    when(mockGeneratorContext.tryCreateResource(
        testLogger, "cssResource/com.test.Bundle.cssMethod.cssmap")).thenReturn(mockOutputStream);
    when(mockGeneratorContext.commitResource(testLogger, mockOutputStream)).thenThrow(
        new UnableToCompleteException());

    JMethod method = mock(JMethod.class);
    JClassType bundleType = mock(JClassType.class);
    when(method.getEnclosingType()).thenReturn(bundleType);
View Full Code Here

    Map<JMethod, String> testMap = new LinkedHashMap<JMethod, String>();
    testMap.put(mockJMethod1, "TESTCSSNAME1");
    testMap.put(mockJMethod2, "TESTCSSNAME2");
    testMap.put(mockJMethod3, "TESTCSSNAME3");
    ByteArrayOutputStream testOutputStream = new ByteArrayOutputStream();
    GeneratorContext mockGeneratorContext = mock(GeneratorContext.class);
    GeneratedResource mockGeneratedResource = mock(GeneratedResource.class);

    when(mockResourceContext.getGeneratorContext()).thenReturn(mockGeneratorContext);
    when(mockGeneratorContext.tryCreateResource(
        testLogger, "cssResource/com.test.Bundle.cssMethod.cssmap")).thenReturn(testOutputStream);
    when(mockJMethod1.getEnclosingType()).thenReturn(mockJClassType1);
    when(mockJClassType1.getQualifiedSourceName()).thenReturn("test.class.type.1");
    when(mockJMethod1.getName()).thenReturn("basename1");
    when(mockJMethod2.getEnclosingType()).thenReturn(mockJClassType2);
    when(mockJClassType2.getQualifiedSourceName()).thenReturn("test.class.type.2");
    when(mockJMethod2.getName()).thenReturn("basename2");
    when(mockJMethod3.getEnclosingType()).thenReturn(mockJClassType3);
    when(mockJClassType3.getQualifiedSourceName()).thenReturn("test.class.type.3");
    when(mockJMethod3.getName()).thenReturn("basename3");
    when(mockGeneratorContext.commitResource(testLogger, testOutputStream)).thenReturn(
        mockGeneratedResource);

    JMethod method = mock(JMethod.class);
    JClassType bundleType = mock(JClassType.class);
    when(method.getEnclosingType()).thenReturn(bundleType);
View Full Code Here

        .runPass();
  }

  private ResourceContext mockResourceContext() {
    ResourceContext context = mock(ResourceContext.class);
    GeneratorContext generatorContext = mock(GeneratorContext.class);
    TypeOracle oracle = mock(TypeOracle.class);
    when(generatorContext.getTypeOracle()).thenReturn(oracle);
    when(context.getGeneratorContext()).thenReturn(generatorContext);
    return context;
  }
View Full Code Here

  }

  private ResourceContext mockResourceContext() {
    ResourceContext context = mock(ResourceContext.class);
    when(context.getImplementationSimpleSourceName()).thenReturn("ImageSpriteCreatorTest");
    GeneratorContext generatorContext = mock(GeneratorContext.class);
    TypeOracle oracle = mock(TypeOracle.class);

    when(oracle.findType(ImageResource.class.getCanonicalName())).thenReturn(imageResourceType);

    when(generatorContext.getTypeOracle()).thenReturn(oracle);
    when(context.getGeneratorContext()).thenReturn(generatorContext);
    return context;
  }
View Full Code Here

  }

  private ResourceContext mockResourceContext() {
    ResourceContext context = mock(ResourceContext.class);
    when(context.getImplementationSimpleSourceName()).thenReturn("ResourceUrlFunctionTest");
    GeneratorContext generatorContext = mock(GeneratorContext.class);
    TypeOracle oracle = mock(TypeOracle.class);

    when(oracle.findType(DataResource.class.getCanonicalName())).thenReturn(dataResourceType);
    when(oracle.findType(ImageResource.class.getCanonicalName())).thenReturn(imageResourceType);

    when(generatorContext.getTypeOracle()).thenReturn(oracle);
    when(context.getGeneratorContext()).thenReturn(generatorContext);
    return context;
  }
View Full Code Here

      writer.println();
      writer.println("@Override");
      writer.println("public DateTimeConstants getDateTimeConstants() {");
      LocalizableGenerator localizableGenerator = new LocalizableGenerator();
      // Avoid warnings for trying to create the same type multiple times
      @SuppressWarnings("hiding")
      GeneratorContext subContext = new CachedGeneratorContext(context);
      generateConstantsLookup(logger, subContext, writer, localizableGenerator,
          runtimeLocales, locale,
          "com.google.gwt.i18n.client.constants.DateTimeConstantsImpl");
      writer.println("}");
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.GeneratorContext

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.