Package com.google.inject

Examples of com.google.inject.ProvisionException


  // RequestScoped because we don't know how efficient it is, so we want it cached.
  @Provides @RequestScoped
  User provideAppengineUser(UserService userService) {
    User user = userService.getCurrentUser();
    if (user == null) {
      throw new ProvisionException("Not logged in");
    }
    return user;
  }
View Full Code Here


        case HBASE_98:
          // for our needs HBase 0.98 is API compatible with 0.96
          instance = createInstance(getHBase96Classname());
          break;
        case UNKNOWN:
          throw new ProvisionException("Unknown HBase version: " + HBaseVersion.getVersionString());
      }
    } catch (ClassNotFoundException cnfe) {
      throw new ProvisionException(cnfe.getMessage(), cnfe);
    }
    return instance;
  }
View Full Code Here

        public void afterInjection(I injectee) {
            try {
                field.setAccessible(true);
                field.set(injectee, logger);
            } catch (IllegalAccessException e) {
                throw new ProvisionException(e.getMessage(), e);
            }
        }
View Full Code Here

   }

   public void testGetCause() {
      AuthorizationException aex = createMock(AuthorizationException.class);
      Message message = new Message(ImmutableList.of(), "test", aex);
      ProvisionException pex = new ProvisionException(ImmutableSet.of(message));
      assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), aex);
   }
View Full Code Here

   }

   public void testGetFirstThrowableOfTypeInner() {
      AuthorizationException aex = createMock(AuthorizationException.class);
      Message message = new Message(ImmutableList.of(), "test", aex);
      ProvisionException pex = new ProvisionException(ImmutableSet.of(message));
      assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), aex);
   }
View Full Code Here

   }

   public void testGetFirstThrowableOfTypeFail() {
      TimeoutException aex = createMock(TimeoutException.class);
      Message message = new Message(ImmutableList.of(), "test", aex);
      ProvisionException pex = new ProvisionException(ImmutableSet.of(message));
      assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), null);
   }
View Full Code Here

      assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), null);
   }

   public void testGetFirstThrowableOfTypeWhenCauseIsNull() {
      Message message = new Message(ImmutableList.of(), "test", null);
      ProvisionException pex = new ProvisionException(ImmutableSet.of(message));
      assertEquals(getFirstThrowableOfType(pex, AuthorizationException.class), null);
   }
View Full Code Here

   @Test(expectedExceptions = AuthorizationException.class)
   public void testPropagateProvisionExceptionAuthorizationException() throws Throwable {
      Exception e = new AuthorizationException();
      propagateIfPossible(
            new ProvisionException(ImmutableSet.of(new Message(ImmutableList.of(), "Error in custom provider", e))),
            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }
View Full Code Here

      case OPENID:
        // OpenID support is bound in WebAppInitializer and Daemon.
      case CUSTOM_EXTENSION:
        break;
      default:
        throw new ProvisionException("Unsupported loginType: " + authConfig.getAuthType());
    }

    install(new UrlModule(urlConfig));
    install(new UiRpcModule());
    install(new GerritRequestModule());
View Full Code Here

      //
      // At the minimum, we can trap problems related to unmatched groups.
      try {
        Pattern.compile(match);
      } catch (PatternSyntaxException e) {
        throw new ProvisionException("Invalid pattern \"" + match
            + "\" in commentlink." + name + ".match: " + e.getMessage());
      }

      String link = cfg.getString("commentlink", name, "link");
      String html = cfg.getString("commentlink", name, "html");
View Full Code Here

TOP

Related Classes of com.google.inject.ProvisionException

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.