@Override public void configure(Binder binder) { binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_FLOW_CONFIG_RESOURCE_HANDLER)) .toInstance(GobblinServiceManager.this.resourceHandler); binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsV2Resource.FLOW_CONFIG_GENERATOR_INJECT_NAME)) .toInstance(GobblinServiceManager.this.v2ResourceHandler); binder.bindConstant() .annotatedWith(Names.named(FlowConfigsResource.INJECT_READY_TO_USE)) .to(Boolean.TRUE); binder.bind(RequesterService.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_REQUESTER_SERVICE)) .toInstance(new NoopRequesterService(config)); } });
@Override public void configure(Binder binder) { binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_FLOW_CONFIG_RESOURCE_HANDLER)) .toInstance(new FlowConfigResourceLocalHandler(flowCatalog)); // indicate that we are in unit testing since the resource is being blocked until flow catalog changes have // been made binder.bindConstant().annotatedWith(Names.named(FlowConfigsResource.INJECT_READY_TO_USE)).to(Boolean.TRUE); binder.bind(RequesterService.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_REQUESTER_SERVICE)).toInstance(new NoopRequesterService(config)); } });
public void testSerDerWithEmptyRequester() throws IOException { List<ServiceRequester> list = new ArrayList<>(); RequesterService rs = new NoopRequesterService(ConfigBuilder.create().build()); String serialize = rs.serialize(list); Properties props = new Properties(); props.put(RequesterService.REQUESTER_LIST, serialize); Config initConfig = ConfigBuilder.create().build(); Config config = initConfig.withFallback(ConfigFactory.parseString(props.toString()).resolve()); Properties props2 = ConfigUtils.configToProperties(config); String serialize2 = props2.getProperty(RequesterService.REQUESTER_LIST); Assert.assertTrue(serialize.equals(serialize2)); List<ServiceRequester> list2 = rs.deserialize(serialize); Assert.assertTrue(list.equals(list2)); }
public void testSerDerWithConfig() throws IOException { ServiceRequester sr1 = new ServiceRequester("kafkaetl", "user", "dv"); ServiceRequester sr2 = new ServiceRequester("gobblin", "group", "dv"); ServiceRequester sr3 = new ServiceRequester("crm-backend", "service", "cert"); List<ServiceRequester> list = new ArrayList<>(); sr1.getProperties().put("customKey", "${123}"); list.add(sr1); list.add(sr2); list.add(sr3); RequesterService rs = new NoopRequesterService(ConfigBuilder.create().build()); String serialize = rs.serialize(list); Properties props = new Properties(); props.put(RequesterService.REQUESTER_LIST, serialize); Config initConfig = ConfigBuilder.create().build(); Config config = initConfig.withFallback(ConfigFactory.parseString(props.toString()).resolve()); Properties props2 = ConfigUtils.configToProperties(config); String serialize2 = props2.getProperty(RequesterService.REQUESTER_LIST); Assert.assertTrue(serialize.equals(serialize2)); List<ServiceRequester> list2 = rs.deserialize(serialize); Assert.assertTrue(list.equals(list2)); } }
@Override public void configure(Binder binder) { binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_FLOW_CONFIG_RESOURCE_HANDLER)) .toInstance(GobblinServiceManager.this.resourceHandler); binder.bind(FlowConfigsResourceHandler.class) .annotatedWith(Names.named(FlowConfigsV2Resource.FLOW_CONFIG_GENERATOR_INJECT_NAME)) .toInstance(GobblinServiceManager.this.v2ResourceHandler); binder.bindConstant() .annotatedWith(Names.named(FlowConfigsResource.INJECT_READY_TO_USE)) .to(Boolean.TRUE); binder.bind(RequesterService.class) .annotatedWith(Names.named(FlowConfigsResource.INJECT_REQUESTER_SERVICE)) .toInstance(new NoopRequesterService(config)); } });