Example #1
0
  static {
    InitVotes.waitFor(MarshallerFramework.class);
    marshallerFactory = GWT.create(MarshallerFactory.class);

    ParserFactory.registerParser(
        new Parser() {
          @Override
          public EJValue parse(String input) {
            return GWTJSON.wrap(JSONParser.parseStrict(input));
          }
        });

    InitVotes.voteFor(MarshallerFramework.class);
  }
 public ServerLocalEventIntegrationTest() {
   InitVotes.registerOneTimePreInitCallback(
       new Runnable() {
         @Override
         public void run() {
           setup();
         }
       });
 }
  @PostConstruct
  private void setup() {
    performLoginStatusChangeActions(userCache.getUser());
    InitVotes.waitFor(SecurityContext.class);
    InitVotes.registerOneTimeDependencyCallback(
        ClientMessageBus.class,
        new Runnable() {

          @Override
          public void run() {
            if (((ClientMessageBusImpl) ErraiBus.get()).getState() == BusState.CONNECTED) {
              initializeCacheFromServer();
            } else {
              // Don't cause initialization to fail if remote communication is disabled
              InitVotes.voteFor(SecurityContext.class);
            }
          }
        });
  }
  @Override
  protected void gwtSetUp() throws Exception {
    setRemoteCommunicationEnabled(false);
    InitVotes.setTimeoutMillis(60000);

    ClientSyncManager.resetInstance();

    // Unfortunately, GWTTestCase does not call our inherited module's onModuleLoad() methods
    // http://code.google.com/p/google-web-toolkit/issues/detail?id=3791
    new IOCBeanManagerLifecycle().resetBeanManager();
    new CDI().__resetSubsystem();
    new Container().onModuleLoad();
    new CDIClientBootstrap().onModuleLoad();

    InitVotes.startInitPolling();

    super.gwtSetUp();

    csm = IOC.getBeanManager().lookupBean(ClientSyncManager.class).getInstance();

    csm.getDesiredStateEm().removeAll();
    csm.getExpectedStateEm().removeAll();
  }
  @Override
  protected void gwtTearDown() throws Exception {
    assertFalse(
        "ClientSyncManager 'sync in progress' flag got stuck on true", csm.isSyncInProgress());

    if (syncBean != null) {
      IOC.getBeanManager().destroyBean(syncBean);
    }

    Container.reset();
    IOC.reset();
    InitVotes.reset();
    setRemoteCommunicationEnabled(true);
    super.gwtTearDown();
  }
  protected void afterLogout(final Runnable test) {
    InitVotes.registerOneTimeInitCallback(
        new Runnable() {

          @Override
          public void run() {
            MessageBuilder.createCall(
                    new RemoteCallback<Void>() {

                      @Override
                      public void callback(Void response) {
                        test.run();
                      }
                    },
                    AuthenticationService.class)
                .logout();
          }
        });
  }
Example #7
0
 @Override
 public void onModuleLoad() {
   InitVotes.startInitPolling();
 }