Skip to content

Commit

Permalink
Add StartupParameters client service
Browse files Browse the repository at this point in the history
Change-Id: I8d739cdc71f3a3f0606fbb130bb35aab5181cfac
  • Loading branch information
ifurnadjiev committed Aug 15, 2018
1 parent 04517f9 commit 6f9ee71
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static org.junit.Assert.assertSame;

import org.eclipse.rap.rwt.client.service.ClientInfo;
import org.eclipse.rap.rwt.client.service.StartupParameters;
import org.junit.Rule;
import org.junit.Test;

Expand Down Expand Up @@ -219,4 +220,23 @@ public void testPrintServiceIsSingleton() {
assertSame( print1, print2 );
}

@Test
public void testHasStartupParametersService() {
TabrisClient client = new TabrisClientImpl();

StartupParameters service = client.getService( StartupParameters.class );

assertNotNull( service );
}

@Test
public void testStartupParametersIsSingleton() {
TabrisClient client = new TabrisClientImpl();

StartupParameters service1 = client.getService( StartupParameters.class );
StartupParameters service2 = client.getService( StartupParameters.class );

assertSame( service1, service2 );
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import org.eclipse.rap.rwt.client.service.ClientInfo;
import org.eclipse.rap.rwt.client.service.ClientService;
import org.eclipse.rap.rwt.client.service.StartupParameters;
import org.eclipse.rap.rwt.internal.client.StartupParametersImpl;

import com.eclipsesource.tabris.ClientStore;
import com.eclipsesource.tabris.TabrisClient;
Expand All @@ -27,6 +29,7 @@
import com.eclipsesource.tabris.push.CloudPush;


@SuppressWarnings("restriction")
public class TabrisClientImpl implements TabrisClient {

public TabrisClientImpl() {
Expand All @@ -38,6 +41,7 @@ private void initializeServices() {
getService( App.class );
getService( ClientStore.class );
getService( CloudPush.class );
getService( StartupParameters.class );
DataWhitelist.register();
}

Expand All @@ -63,6 +67,8 @@ public <T extends ClientService> T getService( Class<T> type ) {
result = ( T )getSessionInstance( GeolocationImpl.class );
} else if( type == Printer.class ) {
result = ( T )getSessionInstance( PrinterImpl.class );
} else if( type == StartupParameters.class ) {
result = ( T )getSessionInstance( StartupParametersImpl.class );
}
return result;
}
Expand Down

0 comments on commit 6f9ee71

Please sign in to comment.