コード例 #1
0
  /**
   * Test method for {@link ManagedResourceStore#checkForUpdate()} and {@link
   * ManagedResourceStore#getUpdateStatus()}.
   */
  public void testCheckForUpdate() {
    final LocalServer ls = Factory.getInstance().createLocalServer();
    ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
    final ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
    mrs.setManifestUrl(getTestManifestURL());
    mrs.checkForUpdate();

    delayTestFinish(5000);
    new Timer() {
      @Override
      public void run() {
        switch (mrs.getUpdateStatus()) {
          case ManagedResourceStore.UPDATE_CHECKING:
          case ManagedResourceStore.UPDATE_DOWNLOADING:
            schedule(500);
            break;
          case ManagedResourceStore.UPDATE_FAILED:
            fail("Failed to update the resource");
            break;
          case ManagedResourceStore.UPDATE_OK:
            assertEquals("gwt-google-apis 0.1", mrs.getCurrentVersion());
            // For some reason on FF getLastUpdateCheckTime() returns negative
            // values.
            // assertTrue(mrs.getLastUpdateCheckTime() > 0);
            finishTest();
            break;
        }
      }
    }.schedule(500);
  }
コード例 #2
0
 /**
  * Test method for {@link ManagedResourceStore#setManifestUrl(String)} and {@link
  * ManagedResourceStore#getManifestUrl()}.
  */
 public void testGetSetManifestUrl() {
   LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   mrs.setManifestUrl(getTestManifestURL());
   assertEquals(getTestManifestURL(), mrs.getManifestUrl());
 }
コード例 #3
0
 /**
  * Test method for {@link ManagedResourceStore#isEnabled()} and {@link
  * ManagedResourceStore#setEnabled(boolean)}.
  */
 public void testIsEnabled() {
   LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   mrs.setEnabled(false);
   assertFalse(mrs.isEnabled());
   mrs.setEnabled(true);
   assertTrue(mrs.isEnabled());
 }
コード例 #4
0
 /** Test method for {@link ManagedResourceStore#setManifestUrl(String)}. */
 public void disabledTestSetManifestURLNull() {
   LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   try {
     mrs.setManifestUrl(null);
     fail("Expected a NullPointerException");
   } catch (NullPointerException e) {
     // Expected to get here
   }
 }
コード例 #5
0
 /** Test method for {@link ManagedResourceStore#getName()}. */
 public void testGetName() {
   LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   assertEquals(MANAGED_RESOURCE_STORE_NAME, mrs.getName());
 }
コード例 #6
0
 /** Test method for {@link ManagedResourceStore#getCurrentVersion()}. */
 public void testGetCurrentVersion() {
   final LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   final ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   assertEquals("", mrs.getCurrentVersion());
 }
コード例 #7
0
 /** Test method for {@link ManagedResourceStore#setManifestUrl(String)}. */
 public void testSetManifestURLEmpty() {
   LocalServer ls = Factory.getInstance().createLocalServer();
   ls.removeManagedStore(MANAGED_RESOURCE_STORE_NAME);
   ManagedResourceStore mrs = ls.createManagedStore(MANAGED_RESOURCE_STORE_NAME);
   mrs.setManifestUrl("");
 }