Package com.google.gwt.resources.ext

Examples of com.google.gwt.resources.ext.ResourceContext


    new CreateConditionalNodes(mutatingVisitController, errorManager).runPass();
    new CreateRuntimeConditionalNodes(mutatingVisitController).runPass();
    new CreateStandardAtRuleNodes(mutatingVisitController, errorManager).runPass();

    ResourceContext context = mockResourceContext();
    Map<String, GssFunction> gssFunctionMap = new GwtGssFunctionMapProvider(context).get();
    new ResolveCustomFunctionNodes(mutatingVisitController, errorManager,
        gssFunctionMap, true, new HashSet<String>()).runPass();
    new ExternalClassesCollector(mutatingVisitController, errorManager)
        .runPass();
View Full Code Here


    new ExternalClassesCollector(mutatingVisitController, errorManager)
        .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

        "}]";
    assertEquals(cssTreeStringExpected, cssTree.getRoot().getBody().toString());
  }

  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

*/
public class CssOutputTestCase extends TestCase {

  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);

View Full Code Here

  public void testOutputCssMapArtifactThrowOnTryCreateResource() throws UnableToCompleteException {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    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);
View Full Code Here

    verifyNoMoreInteractions(mockGeneratorContext);
  }

  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);
View Full Code Here

  public void testOutputCssMapArtifactThrowOnCommitResource() throws UnableToCompleteException {
    UnitTestTreeLogger.Builder builder = new UnitTestTreeLogger.Builder();
    builder.expectWarn(
        "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());
View Full Code Here

    verify(mockGeneratorContext).commitResource(testLogger, mockOutputStream);
  }

  public void testOutputCssMapArtifactWithTestData() throws UnableToCompleteException {
    UnitTestTreeLogger testLogger = new UnitTestTreeLogger.Builder().createLogger();
    ResourceContext mockResourceContext = mock(ResourceContext.class);
    JMethod mockJMethod1 = mock(JMethod.class);
    JMethod mockJMethod2 = mock(JMethod.class);
    JMethod mockJMethod3 = mock(JMethod.class);
    JClassType mockJClassType1 = mock(JClassType.class);
    JClassType mockJClassType2 = mock(JClassType.class);
    JClassType mockJClassType3 = mock(JClassType.class);
    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");
View Full Code Here

    return ImmutableList.of(input);
  }

  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

TOP

Related Classes of com.google.gwt.resources.ext.ResourceContext

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.