Package org.eclipse.rap.json

Examples of org.eclipse.rap.json.JsonObject


    remoteUI.setUi( ui );
    remoteUI.setController( mock( Controller.class ) );
    doReturn( "bar" ).when( remoteUI ).getPageId( "foo" );
    environment.getRemoteObject().setHandler( remoteUI );

    JsonObject properties = new JsonObject().add( "pageId", "foo" );
    environment.dispatchNotify( "ShowPage", properties );

    verify( pageOperator ).openPage( "bar" );
  }
View Full Code Here


  @Test
  public void testDelegatesNotifyWithProperties() {
    AppImpl app = new AppImpl();
    AppListener listener = mock( AppListener.class );
    app.addEventListener( PAUSE, listener );
    JsonObject properties = new JsonObject();
    properties.add( "foo", "bar" );

    environment.dispatchNotifyOnServiceObject( "Pause", properties );

    ArgumentCaptor<AppEvent> captor = ArgumentCaptor.forClass( AppEvent.class );
    verify( listener ).handleEvent( captor.capture() );
View Full Code Here

  }

  @Test
  public void testSetsTabrisVersion() {
    AppImpl app = new AppImpl();
    JsonObject properties = new JsonObject();
    properties.set( "tabrisVersion", "1.3.0" );

    app.handleSet( properties );

    String tabrisVersion = app.getTabrisVersion();
    assertEquals( "1.3.0", tabrisVersion );
View Full Code Here

  }

  @Test
  public void testSetsAppId() {
    AppImpl app = new AppImpl();
    JsonObject properties = new JsonObject();
    properties.set( "id", "foo.bar" );

    app.handleSet( properties );

    String id = app.getId();
    assertEquals( "foo.bar", id );
View Full Code Here

  }

  @Test
  public void testSetsVersion() {
    AppImpl app = new AppImpl();
    JsonObject properties = new JsonObject();
    properties.set( "version", "1.4.0" );

    app.handleSet( properties );

    String version = app.getVersion();
    assertEquals( "1.4.0", version );
View Full Code Here

  }

  @Test
  public void testSetsOpenurl() {
    AppImpl app = new AppImpl();
    JsonObject properties = new JsonObject();
    properties.set( "openUrl", "app://foo.bar/path" );

    app.handleSet( properties );

    String openUrl = app.getOpenUrl();
    assertEquals( "app://foo.bar/path", openUrl );
View Full Code Here

    assertEquals( "en", visitorInformation.getParameter().get( getRequestKey( RequestKeys.VISITOR_LANGUAGE_OVERRIDE ) ) );
    assertCustomVariables( visitorInformation );
  }

  private void assertCustomVariables( VisitorInformation visitorInformation ) {
    JsonObject customVariables = JsonObject.readFrom( ( String )visitorInformation.getParameter()
      .get( getRequestKey( RequestKeys.VISITOR_CUSTOM_VARIABLES ) ) );
    assertEquals( "appVersion", customVariables.get( "1" ).asArray().get( 1 ).asString() );
    assertEquals( "en-CA", customVariables.get( "2" ).asArray().get( 1 ).asString() );
    assertEquals( "model", customVariables.get( "3" ).asArray().get( 1 ).asString() );
    assertEquals( "osVersion", customVariables.get( "4" ).asArray().get( 1 ).asString() );
    assertEquals( "vendor", customVariables.get( "5" ).asArray().get( 1 ).asString() );
    assertEquals( "tabrisVersion", customVariables.get( "6" ).asArray().get( 1 ).asString() );
  }
View Full Code Here

  public void testRenderInitializationRendersMessage() throws IOException {
    composite.setMessage( "foo" );

    lca.renderInitialization( composite );

    JsonObject properties = getOperationProperties( WidgetUtil.getId( composite ), CREATE, null );
    assertEquals( "foo", properties.get( "message" ).asString() );
  }
View Full Code Here

  public void testRenderInitializationRendersRefreshListen() throws IOException {
    composite.addRefreshListener( mock( RefreshListener.class ) );

    lca.renderInitialization( composite );

    JsonObject properties = getOperationProperties( WidgetUtil.getId( composite ), LISTEN, null );
    assertTrue( properties.get( "Refresh" ).asBoolean() );
  }
View Full Code Here

  public void testRenderListenToRefreshToRefresh() {
    composite.addRefreshListener( mock( RefreshListener.class ) );

    lca.renderListenToRefresh( composite );

    JsonObject properties = getOperationProperties( WidgetUtil.getId( composite ), LISTEN, null );
    assertTrue( properties.get( "Refresh" ).asBoolean() );
  }
View Full Code Here

TOP

Related Classes of org.eclipse.rap.json.JsonObject

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.