/** * before class, as we need to ensure that the filter is threadsafe. * * @throws IOException * */ @BeforeClass protected void createFilter() throws IOException { Injector injector = ContextBuilder.newBuilder(new ChefApiMetadata()).credentials(USER_ID, PRIVATE_KEY) .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())).buildInjector(); HttpUtils utils = injector.getInstance(HttpUtils.class); Crypto crypto = injector.getInstance(Crypto.class); Supplier<PrivateKey> privateKey = injector.getInstance(Key.get(new TypeLiteral<Supplier<PrivateKey>>() { })); signing_obj = new SignedHeaderAuth(new SignatureWire(), Suppliers.ofInstance(new Credentials(USER_ID, PRIVATE_KEY)), privateKey, new Provider<String>() { @Override public String get() { return TIMESTAMP_ISO8601; } }, utils, crypto); }
/** * before class, as we need to ensure that the filter is threadsafe. * * @throws IOException * */ @BeforeClass protected void createFilter() throws IOException { Injector injector = ContextBuilder.newBuilder(new ChefApiMetadata()).credentials(USER_ID, PRIVATE_KEY) .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())).buildInjector(); HttpUtils utils = injector.getInstance(HttpUtils.class); Supplier<PrivateKey> privateKey = injector.getInstance(Key.get(new TypeLiteral<Supplier<PrivateKey>>() { })); signing_obj = new SignedHeaderAuth(new SignatureWire(), Suppliers.ofInstance(new Credentials(USER_ID, PRIVATE_KEY)), privateKey, new Provider<String>() { @Override public String get() { return TIMESTAMP_ISO8601; } }, utils); }