Package org.eclipse.rap.json

Examples of org.eclipse.rap.json.JsonObject


  }

  @Test( expected = IllegalArgumentException.class )
  public void testSwipeEventFailsWithoutItemProperty() {
    SwipeOperationHandler handler = new SwipeOperationHandler( mock( Swipe.class ) );
    JsonObject properties = new JsonObject();

    handler.handleNotify( "Swipe", properties );
  }
View Full Code Here


  }

  @Test( expected = IllegalArgumentException.class )
  public void testSwipeEventFailsWithNoIntegerItemProperty() {
    SwipeOperationHandler handler = new SwipeOperationHandler( mock( Swipe.class ) );
    JsonObject properties = new JsonObject();
    properties.add( "item", "0" );

    handler.handleNotify( "Swipe", properties );
  }
View Full Code Here

    verify( remoteObject, never() ).call( eq( "remove" ), any( JsonObject.class ) );
  }

  private void assertLoadProperties( List<JsonObject> list, TestItem firstItem, TestItem secondItem ) {
    JsonObject properties1 = list.get( 0 );
    assertEquals( 0, properties1.get( "index" ).asInt() );
    assertEquals( WidgetUtil.getId( firstItem.getLoadedComposite() ), properties1.get( "control" ).asString() );
    JsonObject properties2 = list.get( 1 );
    assertEquals( 1, properties2.get( "index" ).asInt() );
    assertEquals( WidgetUtil.getId( secondItem.getLoadedComposite() ), properties2.get( "control" ).asString() );
  }
View Full Code Here

    SwipeItemProvider itemProvider = mockProvider( 2 );
    mockSwipeItem( itemProvider, 0, true );
    mockSwipeItem( itemProvider, 1, true );
    Swipe swipe = new Swipe( shell, itemProvider );
    swipe.show( 0 );
    JsonObject properties = new JsonObject();
    properties.add( "item", 1 );

    environment.dispatchNotify( "Swipe", properties );

    verify( remoteObject, times( 1 ) ).set( "active", 0 );
    verify( remoteObject, never() ).set( "active", 1 );
View Full Code Here

  public void testDelegatesPositionWhenGetPosition() throws ParseException {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

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

    GeolocationListener listener2 = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener1 );
    geolocation.addGeolocationListener( listener2 );
    geolocation.determineCurrentPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
    verify( listener1 ).positionReceived( captor.capture() );
View Full Code Here

  public void testDelegatesPositionWhenWatch() throws ParseException {
    GeolocationListener listener = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

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

    GeolocationListener listener2 = mock( GeolocationListener.class );
    GeolocationImpl geolocation = new GeolocationImpl();
    geolocation.addGeolocationListener( listener1 );
    geolocation.addGeolocationListener( listener2 );
    geolocation.watchPosition( new GeolocationOptions() );
    JsonObject properties = createPositionData();

    environment.dispatchNotifyOnServiceObject( "LocationUpdate", properties );

    ArgumentCaptor<Position> captor = ArgumentCaptor.forClass( Position.class );
    verify( listener1 ).positionReceived( captor.capture() );
View Full Code Here

      ListenOperation operation = findListenOperation( message, target );
      if( operation != null ) {
        return operation.getProperties();
      }
    }
    return new JsonObject();
  }
View Full Code Here

    assertPositionData( captor.getAllValues().get( 0 ) );
    assertPositionData( captor.getAllValues().get( 1 ) );
  }

  private JsonObject createPositionData() {
    JsonObject properties = new JsonObject();
    properties.add( "timestamp", "2012-03-12T10:40:13+0100" );
    properties.add( "latitude", 101.1 );
    properties.add( "longitude", 43.1 );
    properties.add( "altitude", 3 );
    properties.add( "accuracy", 5.1 );
    properties.add( "altitudeAccuracy", 1.1 );
    properties.add( "heading", 21.1 );
    properties.add( "speed", 216.1 );
    return properties;
  }
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.