Package com.google.k2crypto.storage.driver

Examples of com.google.k2crypto.storage.driver.Driver


   * @param address URI address to open.
   * @param reason Reason the address is rejected.
   */
  protected void checkRejectAddress(
      URI address, IllegalAddressException.Reason reason) {
    Driver driver = newDriver();
    try {
      driver.open(address);
      fail("Should reject " + address);
    } catch (StoreException ex) {
      throw new AssertionError("Unexpected", ex);
    } catch (IllegalAddressException expected) {
      assertEquals(reason, expected.getReason());
      assertEquals(address.toString(), expected.getAddress());
    } finally {
      driver.close();
    }
  }
View Full Code Here


   *
   * @throws K2Exception if there is an unexpected failure opening the address.
   */
  protected void checkNormalization(String expected, String address)
      throws K2Exception {
    Driver driver = newDriver();
    try {
      URI result = driver.open(URI.create(address));
      assertEquals(expected, result.toString());
    } finally {
      driver.close();
    }
  }
View Full Code Here

   * Instantiates a new store (driver) from the driver installation.
   */
  Driver instantiate() {
    try {
      // Use reflection to instantiate the driver
      Driver driver = constructor.newInstance();
      driver.initialize(context);
      return driver;
    } catch (InvocationTargetException ex) {
      Throwable t = ex.getCause();
      // Re-throw throwables that do not need an explicit catch. (This should
      // not actually happen unless the driver has a flaky constructor.)
View Full Code Here

      checkRejectAddress(
          generateAddress(db, oneCharTooLongId),
          IllegalAddressException.Reason.INVALID_FRAGMENT);

      // Test acceptance of identifier at maximum length
      Driver driver = newDriver();
      try {
        driver.open(generateAddress(db, generateString(MAX_KEY_ID_LENGTH)));
      } finally {
        driver.close();
     
    } finally {
      db.delete();
    }
  }
View Full Code Here

      Class<? extends Driver> driverClass) throws StorageDriverException {
    InstalledDriver idriver = new InstalledDriver(context, driverClass);
    assertEquals(context, idriver.getContext());
    assertEquals(driverClass, idriver.getDriverClass());
    assertEquals(driverClass.hashCode(), idriver.hashCode());
    Driver driver = idriver.instantiate();
    assertTrue(driverClass.isInstance(driver));
    assertEquals(context, ((MockDriver)driver).context);
    return idriver;
  }
View Full Code Here

    checkRejectAddress(
        testingAddress + oneCharTooLongName,
        IllegalAddressException.Reason.INVALID_PATH);
   
    // Test acceptance of filename at maximum length
    Driver driver = newDriver();
    try {
      driver.open(URI.create(
          testingAddress + generateString(MAX_FILENAME_LENGTH)));
    } finally {
      driver.close();
   
  }
View Full Code Here

TOP

Related Classes of com.google.k2crypto.storage.driver.Driver

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.