target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void testSelect() { for (RouteRuleGroupModel routeRuleGroup : newRouteRuleGroups()) { routeRuleGroupDao.insertOrUpdate(routeRuleGroup); RouteRuleGroupModel filter = new RouteRuleGroupModel(); filter.setGroupId(routeRuleGroup.getGroupId()); Assert.assertEquals(1, routeRuleGroupDao.select(filter).size()); As... | public List<RouteRuleGroupModel> select(RouteRuleGroupModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, Long> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId()); conditions.put("route_rule_id=?", filter.getRouteRuleId()); conditions.put("group_id=?", filter.getGroupId()); Set<Stri... | RouteRuleGroupDao { public List<RouteRuleGroupModel> select(RouteRuleGroupModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, Long> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId()); conditions.put("route_rule_id=?", filter.getRouteRuleId()); conditions.put("group_id=?", filter.get... | RouteRuleGroupDao { public List<RouteRuleGroupModel> select(RouteRuleGroupModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, Long> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId()); conditions.put("route_rule_id=?", filter.getRouteRuleId()); conditions.put("group_id=?", filter.get... | RouteRuleGroupDao { public List<RouteRuleGroupModel> select(RouteRuleGroupModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, Long> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId()); conditions.put("route_rule_id=?", filter.getRouteRuleId()); conditions.put("group_id=?", filter.get... | RouteRuleGroupDao { public List<RouteRuleGroupModel> select(RouteRuleGroupModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, Long> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId()); conditions.put("route_rule_id=?", filter.getRouteRuleId()); conditions.put("group_id=?", filter.get... |
@Test public void testRelease() { for (RouteRuleGroupModel routeRuleGroup : newRouteRuleGroups()) { routeRuleGroupDao.insertOrUpdate(routeRuleGroup); RouteRuleGroupModel valueBeforeReleased = query(routeRuleGroup); assertRouteRuleGroup(routeRuleGroup, valueBeforeReleased); if (routeRuleGroup.getUnreleasedWeight() != nu... | protected void release(final List<RouteRuleGroupModel> models) { checkReleaseArgument(models); DataConfig.jdbcTemplate().batchUpdate("update service_route_rule_group set weight = unreleased_weight where route_rule_id=? and group_id=?", new BatchPreparedStatementSetter() { @Override public void setValues(PreparedStateme... | RouteRuleGroupDao { protected void release(final List<RouteRuleGroupModel> models) { checkReleaseArgument(models); DataConfig.jdbcTemplate().batchUpdate("update service_route_rule_group set weight = unreleased_weight where route_rule_id=? and group_id=?", new BatchPreparedStatementSetter() { @Override public void setVa... | RouteRuleGroupDao { protected void release(final List<RouteRuleGroupModel> models) { checkReleaseArgument(models); DataConfig.jdbcTemplate().batchUpdate("update service_route_rule_group set weight = unreleased_weight where route_rule_id=? and group_id=?", new BatchPreparedStatementSetter() { @Override public void setVa... | RouteRuleGroupDao { protected void release(final List<RouteRuleGroupModel> models) { checkReleaseArgument(models); DataConfig.jdbcTemplate().batchUpdate("update service_route_rule_group set weight = unreleased_weight where route_rule_id=? and group_id=?", new BatchPreparedStatementSetter() { @Override public void setVa... | RouteRuleGroupDao { protected void release(final List<RouteRuleGroupModel> models) { checkReleaseArgument(models); DataConfig.jdbcTemplate().batchUpdate("update service_route_rule_group set weight = unreleased_weight where route_rule_id=? and group_id=?", new BatchPreparedStatementSetter() { @Override public void setVa... |
@Test public void testPublish() { for (RouteRuleGroupModel routeRuleGroup : newRouteRuleGroups()) { routeRuleGroupDao.publish(routeRuleGroup); RouteRuleGroupModel published = query(routeRuleGroup); Assert.assertEquals(routeRuleGroup.getRouteRuleId(), published.getRouteRuleId()); Assert.assertEquals(routeRuleGroup.getGr... | protected void publish(final RouteRuleGroupModel... models) { publish(Lists.newArrayList(models)); } | RouteRuleGroupDao { protected void publish(final RouteRuleGroupModel... models) { publish(Lists.newArrayList(models)); } } | RouteRuleGroupDao { protected void publish(final RouteRuleGroupModel... models) { publish(Lists.newArrayList(models)); } } | RouteRuleGroupDao { protected void publish(final RouteRuleGroupModel... models) { publish(Lists.newArrayList(models)); } List<RouteRuleGroupModel> query(); RouteRuleGroupModel generateGroup(RouteRuleGroupModel routeRuleGroup); List<RouteRuleGroupModel> select(RouteRuleGroupModel filter); List<RouteRuleGroupModel> sele... | RouteRuleGroupDao { protected void publish(final RouteRuleGroupModel... models) { publish(Lists.newArrayList(models)); } List<RouteRuleGroupModel> query(); RouteRuleGroupModel generateGroup(RouteRuleGroupModel routeRuleGroup); List<RouteRuleGroupModel> select(RouteRuleGroupModel filter); List<RouteRuleGroupModel> sele... |
@Test public void testGetService_ShouldReturnEmptyInstances() { Assert.assertTrue(CollectionUtils.isEmpty(_client.getService(Services.newDiscoverConfig()).getInstances())); } | public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.get(0); } throw new RuntimeException("not found any serv... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... |
@Test public void testInsert() { final GroupOperationLogModel log1 = newModel(); final GroupOperationLogModel log2 = newModel(); log1.setComplete(true); log2.setComplete(true); final List<GroupOperationLogModel> logs = Lists.newArrayList(log1, log2); groupOperationLogDao.insert(log1, log2); for (final GroupOperationLog... | public void insert(final GroupOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } | GroupOperationLogDao { public void insert(final GroupOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } } | GroupOperationLogDao { public void insert(final GroupOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupOperationLogDao(); } | GroupOperationLogDao { public void insert(final GroupOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupOperationLogDao(); List<GroupOperationLog> select(GroupOperationLogModel filter, Boolean complete); List<GroupOperationLog> query... | GroupOperationLogDao { public void insert(final GroupOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupOperationLogDao(); List<GroupOperationLog> select(GroupOperationLogModel filter, Boolean complete); List<GroupOperationLog> query... |
@Test public void testInsert() { final RouteRuleGroupLogModel log1 = newModel(); final RouteRuleGroupLogModel log2 = newModel(); final List<RouteRuleGroupLogModel> logs = Lists.newArrayList(log1, log2); routeRuleGroupLogDao.insert(log1, log2); for (final RouteRuleGroupLogModel log : logs) { final List<RouteRuleGroupLog... | public void insert(final RouteRuleGroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } | RouteRuleGroupLogDao { public void insert(final RouteRuleGroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } } | RouteRuleGroupLogDao { public void insert(final RouteRuleGroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private RouteRuleGroupLogDao(); } | RouteRuleGroupLogDao { public void insert(final RouteRuleGroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private RouteRuleGroupLogDao(); List<RouteRuleGroupLog> select(RouteRuleGroupLogModel filter); List<RouteRuleGroupLog> query(final String cond... | RouteRuleGroupLogDao { public void insert(final RouteRuleGroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private RouteRuleGroupLogDao(); List<RouteRuleGroupLog> select(RouteRuleGroupLogModel filter); List<RouteRuleGroupLog> query(final String cond... |
@Test public void testInsert() { final GroupInstanceLogModel log1 = newModel(); final GroupInstanceLogModel log2 = newModel(); final List<GroupInstanceLogModel> logs = Lists.newArrayList(log1, log2); groupInstanceLogDao.insert(log1, log2); for (final GroupInstanceLogModel log : logs) { final List<GroupInstanceLog> logM... | protected void insert(final GroupInstanceLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } | GroupInstanceLogDao { protected void insert(final GroupInstanceLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } } | GroupInstanceLogDao { protected void insert(final GroupInstanceLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupInstanceLogDao(); } | GroupInstanceLogDao { protected void insert(final GroupInstanceLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupInstanceLogDao(); List<GroupInstanceLog> select(GroupInstanceLogModel filter); List<GroupInstanceLog> query(final String conditi... | GroupInstanceLogDao { protected void insert(final GroupInstanceLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupInstanceLogDao(); List<GroupInstanceLog> select(GroupInstanceLogModel filter); List<GroupInstanceLog> query(final String conditi... |
@Test public void testInsert() { final GroupLogModel log1 = newModel(); final GroupLogModel log2 = newModel(); final List<GroupLogModel> logs = Lists.newArrayList(log1, log2); groupLogDao.insert(log1, log2); for (final GroupLogModel log : logs) { final List<GroupLog> logModels = query(log); Assert.assertEquals(1, logMo... | public void insert(final GroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } | GroupLogDao { public void insert(final GroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } } | GroupLogDao { public void insert(final GroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupLogDao(); } | GroupLogDao { public void insert(final GroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupLogDao(); List<GroupLog> select(GroupLogModel filter); List<GroupLog> query(final String condition, final List<Object> args); void insert(final Gro... | GroupLogDao { public void insert(final GroupLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private GroupLogDao(); List<GroupLog> select(GroupLogModel filter); List<GroupLog> query(final String condition, final List<Object> args); void insert(final Gro... |
@Test public void testInsert() { final ZoneOperationLogModel log1 = newZoneOperationLogModel(); final ZoneOperationLogModel log2 = newZoneOperationLogModel(); log1.setComplete(true); log2.setComplete(true); final List<ZoneOperationLogModel> logs = Lists.newArrayList(log1, log2); zoneOperationLogDao.insert(log1, log2); ... | public void insert(final ZoneOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } | ZoneOperationLogDao { public void insert(final ZoneOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } } | ZoneOperationLogDao { public void insert(final ZoneOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private ZoneOperationLogDao(); } | ZoneOperationLogDao { public void insert(final ZoneOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private ZoneOperationLogDao(); List<ZoneOperationLog> select(ZoneOperationLogModel filter, Boolean complete); List<ZoneOperationLog> query(final... | ZoneOperationLogDao { public void insert(final ZoneOperationLogModel... logs) { if ((logs == null) || (logs.length == 0)) { return; } this.insert(Lists.newArrayList(logs)); } private ZoneOperationLogDao(); List<ZoneOperationLog> select(ZoneOperationLogModel filter, Boolean complete); List<ZoneOperationLog> query(final... |
@Test public void testInsertOrUpdate() { ZoneOperationModel zone = newZoneOperation(); zoneOperationDao.insertOrUpdate(zone); assertZoneOperation(zone, query(zone)); zoneOperationDao.insertOrUpdate(zone); assertZoneOperation(zone, query(zone)); } | public void insertOrUpdate(ZoneOperationModel... operationModels) { insertOrUpdate(Lists.newArrayList(operationModels)); } | ZoneOperationDao { public void insertOrUpdate(ZoneOperationModel... operationModels) { insertOrUpdate(Lists.newArrayList(operationModels)); } } | ZoneOperationDao { public void insertOrUpdate(ZoneOperationModel... operationModels) { insertOrUpdate(Lists.newArrayList(operationModels)); } private ZoneOperationDao(); } | ZoneOperationDao { public void insertOrUpdate(ZoneOperationModel... operationModels) { insertOrUpdate(Lists.newArrayList(operationModels)); } private ZoneOperationDao(); List<ZoneOperationModel> query(); void delete(final ZoneOperationModel... zoneOperations); void delete(final List<ZoneOperationModel> zoneOperations)... | ZoneOperationDao { public void insertOrUpdate(ZoneOperationModel... operationModels) { insertOrUpdate(Lists.newArrayList(operationModels)); } private ZoneOperationDao(); List<ZoneOperationModel> query(); void delete(final ZoneOperationModel... zoneOperations); void delete(final List<ZoneOperationModel> zoneOperations)... |
@Test public void testDelete() { ZoneOperationModel zone = newZoneOperation(); zoneOperationDao.insertOrUpdate(zone); ZoneOperationModel copy1 = query(zone); zoneOperationDao.delete(zone); Assert.assertNull(query(zone, 0)); zoneOperationDao.insertOrUpdate(zone); ZoneOperationModel copy2 = query(zone); assertZoneOperati... | public void delete(final ZoneOperationModel... zoneOperations) { delete(Lists.newArrayList(zoneOperations)); } | ZoneOperationDao { public void delete(final ZoneOperationModel... zoneOperations) { delete(Lists.newArrayList(zoneOperations)); } } | ZoneOperationDao { public void delete(final ZoneOperationModel... zoneOperations) { delete(Lists.newArrayList(zoneOperations)); } private ZoneOperationDao(); } | ZoneOperationDao { public void delete(final ZoneOperationModel... zoneOperations) { delete(Lists.newArrayList(zoneOperations)); } private ZoneOperationDao(); List<ZoneOperationModel> query(); void delete(final ZoneOperationModel... zoneOperations); void delete(final List<ZoneOperationModel> zoneOperations); void inser... | ZoneOperationDao { public void delete(final ZoneOperationModel... zoneOperations) { delete(Lists.newArrayList(zoneOperations)); } private ZoneOperationDao(); List<ZoneOperationModel> query(); void delete(final ZoneOperationModel... zoneOperations); void delete(final List<ZoneOperationModel> zoneOperations); void inser... |
@Test public void testSelect() { ZoneOperationModel zone = newZoneOperation(); zoneOperationDao.insertOrUpdate(zone); ZoneOperationModel filter = new ZoneOperationModel(); filter.setServiceId(zone.getServiceId()); filter.setZoneId(zone.getZoneId()); assertZoneOperation(zone, zoneOperationDao.select(filter).get(0)); } | public List<ZoneOperationModel> select(ZoneOperationModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, String> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId() == null ? null : Long.toString(filter.getId())); conditions.put("service_id=?", filter.getServiceId()); conditions.put("r... | ZoneOperationDao { public List<ZoneOperationModel> select(ZoneOperationModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, String> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId() == null ? null : Long.toString(filter.getId())); conditions.put("service_id=?", filter.getServiceId())... | ZoneOperationDao { public List<ZoneOperationModel> select(ZoneOperationModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, String> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId() == null ? null : Long.toString(filter.getId())); conditions.put("service_id=?", filter.getServiceId())... | ZoneOperationDao { public List<ZoneOperationModel> select(ZoneOperationModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, String> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId() == null ? null : Long.toString(filter.getId())); conditions.put("service_id=?", filter.getServiceId())... | ZoneOperationDao { public List<ZoneOperationModel> select(ZoneOperationModel filter) { ValueCheckers.notNull(filter, "filter"); Map<String, String> conditions = Maps.newHashMap(); conditions.put("id=?", filter.getId() == null ? null : Long.toString(filter.getId())); conditions.put("service_id=?", filter.getServiceId())... |
@Test public void testGet() throws Exception { Assert.assertNull(tree.get(null)); Assert.assertNull(tree.get(new ArrayList<String>())); Assert.assertEquals("key1", tree.get(key1)); Assert.assertEquals(null, tree.get(key2)); Assert.assertEquals("key3", tree.get(key3)); Assert.assertEquals(null, tree.get(key4)); Assert.a... | public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } | SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } } | SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } } | SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } V getValue... | SearchTree { public V get(List<K> cascadingFactors) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.get(factors); } V getValue... |
@Test public void testAdd() throws Exception { SearchTree<String,String> tree = new SearchTree<>(); tree.add(null, null); } | public void add(List<K> cascadingFactors, V value) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { this.value = value; return; } List<K> factors = Lists.newArrayList(cascadingFactors); K factor = factors.remove(0); ValueCheckers.notNull(factor, "factor"); SearchTree<K, V> child = children.get(factor); if (chi... | SearchTree { public void add(List<K> cascadingFactors, V value) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { this.value = value; return; } List<K> factors = Lists.newArrayList(cascadingFactors); K factor = factors.remove(0); ValueCheckers.notNull(factor, "factor"); SearchTree<K, V> child = children.get(fac... | SearchTree { public void add(List<K> cascadingFactors, V value) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { this.value = value; return; } List<K> factors = Lists.newArrayList(cascadingFactors); K factor = factors.remove(0); ValueCheckers.notNull(factor, "factor"); SearchTree<K, V> child = children.get(fac... | SearchTree { public void add(List<K> cascadingFactors, V value) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { this.value = value; return; } List<K> factors = Lists.newArrayList(cascadingFactors); K factor = factors.remove(0); ValueCheckers.notNull(factor, "factor"); SearchTree<K, V> child = children.get(fac... | SearchTree { public void add(List<K> cascadingFactors, V value) { if (CollectionValues.isNullOrEmpty(cascadingFactors)) { this.value = value; return; } List<K> factors = Lists.newArrayList(cascadingFactors); K factor = factors.remove(0); ValueCheckers.notNull(factor, "factor"); SearchTree<K, V> child = children.get(fac... |
@Test public void testGetService_ShouldReturnIntances() throws Exception { final Service service = _client.getService(new DiscoveryConfig(ArtemisClientConstants.RegistryService.Net.serviceKey)); Assert.assertNotNull(service); Assert.assertTrue(service.getInstances().size() > 0); } | public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.get(0); } throw new RuntimeException("not found any serv... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public Service getService(final DiscoveryConfig discoveryConfig) { Preconditions.checkArgument(discoveryConfig != null, "discoveryConfig"); final List<Service> services = getServices(Lists.newArrayList(discoveryConfig)); if (services.size() > 0) { return services.g... |
@Test public void testFirst() throws Exception { Assert.assertNull(tree.first(null)); Assert.assertNull(tree.first(new ArrayList<String>())); Assert.assertEquals("key1", tree.first(key1)); Assert.assertEquals("key1", tree.first(key2)); Assert.assertEquals("key1", tree.first(key3)); Assert.assertEquals("key1", tree.firs... | public V first(List<K> cascadingFactors) { if (value != null || CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.first(factors); } | SearchTree { public V first(List<K> cascadingFactors) { if (value != null || CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.first(fa... | SearchTree { public V first(List<K> cascadingFactors) { if (value != null || CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.first(fa... | SearchTree { public V first(List<K> cascadingFactors) { if (value != null || CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.first(fa... | SearchTree { public V first(List<K> cascadingFactors) { if (value != null || CollectionValues.isNullOrEmpty(cascadingFactors)) { return value; } List<K> factors = Lists.newArrayList(cascadingFactors); SearchTree<K, V> g = children.get(factors.remove(0)); if (g == null) { return defaultChildrenValue; } return g.first(fa... |
@Test public void testFixWeight() { Assert.assertEquals(ServiceGroups.DEFAULT_WEIGHT_VALUE, ServiceGroups.fixWeight(null)); Assert.assertEquals(ServiceGroups.MIN_WEIGHT_VALUE, ServiceGroups.fixWeight(ServiceGroups.MIN_WEIGHT_VALUE)); Assert.assertEquals(ServiceGroups.MAX_WEIGHT_VALUE, ServiceGroups.fixWeight(ServiceGro... | public static int fixWeight(Integer weight) { if (weight == null || weight < MIN_WEIGHT_VALUE) { return DEFAULT_WEIGHT_VALUE; } if (weight > MAX_WEIGHT_VALUE) { return MAX_WEIGHT_VALUE; } return weight; } | ServiceGroups { public static int fixWeight(Integer weight) { if (weight == null || weight < MIN_WEIGHT_VALUE) { return DEFAULT_WEIGHT_VALUE; } if (weight > MAX_WEIGHT_VALUE) { return MAX_WEIGHT_VALUE; } return weight; } } | ServiceGroups { public static int fixWeight(Integer weight) { if (weight == null || weight < MIN_WEIGHT_VALUE) { return DEFAULT_WEIGHT_VALUE; } if (weight > MAX_WEIGHT_VALUE) { return MAX_WEIGHT_VALUE; } return weight; } private ServiceGroups(); } | ServiceGroups { public static int fixWeight(Integer weight) { if (weight == null || weight < MIN_WEIGHT_VALUE) { return DEFAULT_WEIGHT_VALUE; } if (weight > MAX_WEIGHT_VALUE) { return MAX_WEIGHT_VALUE; } return weight; } private ServiceGroups(); static int fixWeight(Integer weight); static boolean isDefaultGroupId(Str... | ServiceGroups { public static int fixWeight(Integer weight) { if (weight == null || weight < MIN_WEIGHT_VALUE) { return DEFAULT_WEIGHT_VALUE; } if (weight > MAX_WEIGHT_VALUE) { return MAX_WEIGHT_VALUE; } return weight; } private ServiceGroups(); static int fixWeight(Integer weight); static boolean isDefaultGroupId(Str... |
@Test public void testGetServices() { final String serviceId = Services.newServiceId(); final List<String> serviceIds = Lists.newArrayList(serviceId, ArtemisClientConstants.RegistryService.Net.serviceKey); final List<DiscoveryConfig> discoveryConfigs = Lists.newArrayList(new DiscoveryConfig(serviceId), new DiscoveryCon... | public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfig... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfig... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfig... | ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfig... |
@Test public void testReload() throws Exception { final ServiceRepository serviceRepository = new ServiceRepository(ArtemisClientConstants.DiscoveryClientConfig); final List<Service> services = Lists.newArrayList(); Assert.assertEquals(0, services.size()); Set<String> serviceKeys = Sets.newHashSet(ArtemisClientConstant... | protected void reload(DiscoveryConfig... configs) { reload(Lists.newArrayList(configs)); } | ServiceDiscovery { protected void reload(DiscoveryConfig... configs) { reload(Lists.newArrayList(configs)); } } | ServiceDiscovery { protected void reload(DiscoveryConfig... configs) { reload(Lists.newArrayList(configs)); } ServiceDiscovery(final ServiceRepository serviceRepository, final ArtemisClientConfig config); } | ServiceDiscovery { protected void reload(DiscoveryConfig... configs) { reload(Lists.newArrayList(configs)); } ServiceDiscovery(final ServiceRepository serviceRepository, final ArtemisClientConfig config); void registerDiscoveryConfig(DiscoveryConfig config); Service getService(DiscoveryConfig config); } | ServiceDiscovery { protected void reload(DiscoveryConfig... configs) { reload(Lists.newArrayList(configs)); } ServiceDiscovery(final ServiceRepository serviceRepository, final ArtemisClientConfig config); void registerDiscoveryConfig(DiscoveryConfig config); Service getService(DiscoveryConfig config); } |
@Test public void toBtpError() { final BtpRuntimeException exception = new BtpRuntimeException(BtpErrorCode.F00_NotAcceptedError, ERROR_MESSAGE); final BtpError error = exception.toBtpError(REQUEST_ID); assertThat(error.getErrorCode()).isEqualTo(BtpErrorCode.F00_NotAcceptedError); assertThat(error.getTriggeredAt()).isE... | public BtpError toBtpError(long requestId) { return toBtpError(requestId, new BtpSubProtocols()); } | BtpRuntimeException extends RuntimeException { public BtpError toBtpError(long requestId) { return toBtpError(requestId, new BtpSubProtocols()); } } | BtpRuntimeException extends RuntimeException { public BtpError toBtpError(long requestId) { return toBtpError(requestId, new BtpSubProtocols()); } BtpRuntimeException(); BtpRuntimeException(BtpErrorCode code, String message); BtpRuntimeException(BtpErrorCode code, String message, Throwable cause); BtpRuntimeExceptio... | BtpRuntimeException extends RuntimeException { public BtpError toBtpError(long requestId) { return toBtpError(requestId, new BtpSubProtocols()); } BtpRuntimeException(); BtpRuntimeException(BtpErrorCode code, String message); BtpRuntimeException(BtpErrorCode code, String message, Throwable cause); BtpRuntimeExceptio... | BtpRuntimeException extends RuntimeException { public BtpError toBtpError(long requestId) { return toBtpError(requestId, new BtpSubProtocols()); } BtpRuntimeException(); BtpRuntimeException(BtpErrorCode code, String message); BtpRuntimeException(BtpErrorCode code, String message, Throwable cause); BtpRuntimeExceptio... |
@Test public void testConnectionThrowsUnexpected() throws Exception { Call call = mock(Call.class); when(httpClientMock.newCall(any())).thenReturn(call); when(call.execute()).thenThrow(new IOException("hey a penny")); expectedException.expect(LinkException.class); expectedException.expectMessage("hey a penny"); link.te... | public void testConnection() { try { final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET); try (Response response = okHttpClient.newCall(okHttpRequest).execute()) { if (response.isSuccessful()) { boolean responseHasOctetStreamContentType = response.headers(CONTENT_TYPE).stream() .findFirs... | IlpOverHttpLink extends AbstractLink<IlpOverHttpLinkSettings> implements Link<IlpOverHttpLinkSettings> { public void testConnection() { try { final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET); try (Response response = okHttpClient.newCall(okHttpRequest).execute()) { if (response.isSucc... | IlpOverHttpLink extends AbstractLink<IlpOverHttpLinkSettings> implements Link<IlpOverHttpLinkSettings> { public void testConnection() { try { final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET); try (Response response = okHttpClient.newCall(okHttpRequest).execute()) { if (response.isSucc... | IlpOverHttpLink extends AbstractLink<IlpOverHttpLinkSettings> implements Link<IlpOverHttpLinkSettings> { public void testConnection() { try { final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET); try (Response response = okHttpClient.newCall(okHttpRequest).execute()) { if (response.isSucc... | IlpOverHttpLink extends AbstractLink<IlpOverHttpLinkSettings> implements Link<IlpOverHttpLinkSettings> { public void testConnection() { try { final Request okHttpRequest = this.constructSendPacketRequest(UNFULFILLABLE_PACKET); try (Response response = okHttpClient.newCall(okHttpRequest).execute()) { if (response.isSucc... |
@Test public void flattenSettingsAlreadyFlattened() { assertThat(LinkSettingsUtils.flattenSettings(flattenedSettings)).isEqualTo(flattenedSettings); } | public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } static Map<String, Object> flattenSettings(Map<String, Object> settings); static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSetting... | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } static Map<String, Object> flattenSettings(Map<String, Object> settings); static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSetting... |
@Test public void flattenSettings() { Map<String, Object> grandsonSettings = ImmutableMap.of("name", "fizz", "age", 15); Map<String, Object> grandDaughterSettings = ImmutableMap.of("name", "buzz", "age", 20); Map<String, Object> sonSettings = ImmutableMap.of("name", "bar", "age", 50, "grandson", grandsonSettings, "gran... | public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } } | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } static Map<String, Object> flattenSettings(Map<String, Object> settings); static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSetting... | LinkSettingsUtils { public static Map<String, Object> flattenSettings(Map<String, Object> settings) { return flattenSettings("", settings); } static Map<String, Object> flattenSettings(Map<String, Object> settings); static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSetting... |
@Test public void getIncomingAuthTypeWithSimple() { assertThat(LinkSettingsUtils.getIncomingAuthType(AbstractHttpLinkSettingsTest.customSettingsSimpleFlat())) .isEqualTo(Optional.of(IlpOverHttpLinkSettings.AuthType.SIMPLE)); assertThat(LinkSettingsUtils.getIncomingAuthType(AbstractHttpLinkSettingsTest.customSettingsSim... | public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void getOutgoingAuthTypeWithSimple() { assertThat(LinkSettingsUtils.getOutgoingAuthType(AbstractHttpLinkSettingsTest.customSettingsSimpleFlat())) .isEqualTo(Optional.of(IlpOverHttpLinkSettings.AuthType.SIMPLE)); assertThat(LinkSettingsUtils.getOutgoingAuthType(AbstractHttpLinkSettingsTest.customSettingsSim... | public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void getIncomingAuthTypeWithJwtHs256() { IlpOverHttpLinkSettings.AuthType authType = IlpOverHttpLinkSettings.AuthType.JWT_HS_256; assertThat( LinkSettingsUtils.getIncomingAuthType(AbstractHttpLinkSettingsTest.customSettingsJwtFlat(authType))) .isEqualTo(Optional.of(authType)); assertThat( LinkSettingsUtils... | public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void getOutgoingAuthTypeWithJwtHs256() { IlpOverHttpLinkSettings.AuthType authType = IlpOverHttpLinkSettings.AuthType.JWT_HS_256; assertThat( LinkSettingsUtils.getOutgoingAuthType(AbstractHttpLinkSettingsTest.customSettingsJwtFlat(authType))) .isEqualTo(Optional.of(authType)); assertThat( LinkSettingsUtils... | public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void getIncomingAuthTypeWithJwtRs256() { IlpOverHttpLinkSettings.AuthType authType = IlpOverHttpLinkSettings.AuthType.JWT_RS_256; assertThat( LinkSettingsUtils.getIncomingAuthType(AbstractHttpLinkSettingsTest.customSettingsJwtFlat(authType))) .isEqualTo(Optional.of(authType)); assertThat( LinkSettingsUtils... | public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getIncomingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(IncomingLinkSettings.HTTP_INCOMING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void getOutgoingAuthTypeWithJwtRs256() { IlpOverHttpLinkSettings.AuthType authType = IlpOverHttpLinkSettings.AuthType.JWT_RS_256; assertThat( LinkSettingsUtils.getOutgoingAuthType(AbstractHttpLinkSettingsTest.customSettingsJwtFlat(authType))) .isEqualTo(Optional.of(authType)); assertThat( LinkSettingsUtils... | public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettings.AuthType::valueOf... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... | LinkSettingsUtils { public static Optional<IlpOverHttpLinkSettings.AuthType> getOutgoingAuthType(Map<String, Object> customSettings) { return Optional.ofNullable(flattenSettings(customSettings).get(OutgoingLinkSettings.HTTP_OUTGOING_AUTH_TYPE)) .map(Object::toString) .map(String::toUpperCase) .map(IlpOverHttpLinkSettin... |
@Test public void checkCaching() { OutgoingLinkSettings linkSettings = createOutgoingSettings(Duration.ofMinutes(5)); JwtHs256BearerTokenSupplier tokenSupplier = new JwtHs256BearerTokenSupplier(secretBytesSupplier, linkSettings); tokenSupplier.get(); tokenSupplier.get(); verify(secretBytesSupplier).get(); } | @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... |
@Test public void decode() throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); IldcpCodecContextFactory.oer().write(packet, os); final IldcpResponsePacket actual = IldcpCodecContextFactory.oer() .read(IldcpResponsePacket.class, new ByteArrayInputStream(os.toByteArray())); assertThat(actua... | @Override public IldcpResponsePacket decode() { final IldcpResponse ildcpResponse; try { ildcpResponse = IldcpCodecContextFactory.oer() .read(IldcpResponse.class, new ByteArrayInputStream(getValueAt(1))); } catch (IOException e) { throw new IldcpCodecException(e.getMessage(), e); } return IldcpResponsePacket.builder() ... | AsnIldcpResponsePacketDataCodec extends AsnSequenceCodec<IldcpResponsePacket> { @Override public IldcpResponsePacket decode() { final IldcpResponse ildcpResponse; try { ildcpResponse = IldcpCodecContextFactory.oer() .read(IldcpResponse.class, new ByteArrayInputStream(getValueAt(1))); } catch (IOException e) { throw new... | AsnIldcpResponsePacketDataCodec extends AsnSequenceCodec<IldcpResponsePacket> { @Override public IldcpResponsePacket decode() { final IldcpResponse ildcpResponse; try { ildcpResponse = IldcpCodecContextFactory.oer() .read(IldcpResponse.class, new ByteArrayInputStream(getValueAt(1))); } catch (IOException e) { throw new... | AsnIldcpResponsePacketDataCodec extends AsnSequenceCodec<IldcpResponsePacket> { @Override public IldcpResponsePacket decode() { final IldcpResponse ildcpResponse; try { ildcpResponse = IldcpCodecContextFactory.oer() .read(IldcpResponse.class, new ByteArrayInputStream(getValueAt(1))); } catch (IOException e) { throw new... | AsnIldcpResponsePacketDataCodec extends AsnSequenceCodec<IldcpResponsePacket> { @Override public IldcpResponsePacket decode() { final IldcpResponse ildcpResponse; try { ildcpResponse = IldcpCodecContextFactory.oer() .read(IldcpResponse.class, new ByteArrayInputStream(getValueAt(1))); } catch (IOException e) { throw new... |
@Test public void checkCachingWithCachingDisabled() { OutgoingLinkSettings linkSettings = createOutgoingSettings(Duration.ofMinutes(0)); JwtHs256BearerTokenSupplier tokenSupplier = new JwtHs256BearerTokenSupplier(secretBytesSupplier, linkSettings); tokenSupplier.get(); tokenSupplier.get(); verify(secretBytesSupplier, t... | @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... |
@Test public void checkCacheExpiry() throws Exception { OutgoingLinkSettings linkSettings = createOutgoingSettings(Duration.ofMillis(2)); JwtHs256BearerTokenSupplier tokenSupplier = new JwtHs256BearerTokenSupplier(secretBytesSupplier, linkSettings); tokenSupplier.get(); Thread.sleep(3); tokenSupplier.get(); verify(secr... | @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } } | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... | JwtHs256BearerTokenSupplier implements BearerTokenSupplier { @Override public String get() { try { return this.ilpOverHttpAuthTokens.get(outgoingLinkSettings.jwtAuthSettings().get().tokenSubject()); } catch (ExecutionException e) { throw new RuntimeException(e); } } JwtHs256BearerTokenSupplier(
final SharedSecret... |
@Test public void now() { for (int i = 0; i < 100; i++) { long micros = DateUtils.now().get(ChronoField.MICRO_OF_SECOND); assertThat(micros % 1000).isEqualTo(0); } } | public static Instant now() { return Instant.now().truncatedTo(ChronoUnit.MILLIS); } | DateUtils { public static Instant now() { return Instant.now().truncatedTo(ChronoUnit.MILLIS); } } | DateUtils { public static Instant now() { return Instant.now().truncatedTo(ChronoUnit.MILLIS); } } | DateUtils { public static Instant now() { return Instant.now().truncatedTo(ChronoUnit.MILLIS); } static Instant now(); } | DateUtils { public static Instant now() { return Instant.now().truncatedTo(ChronoUnit.MILLIS); } static Instant now(); } |
@Test public void createAccount() throws IOException, URISyntaxException { String testClient = "testClient"; String accountBody = "{\"ilp_address\":\"test.xpring-dev.rs1." + testClient + "\"," + "\"username\":\"" + testClient + "\"," + "\"asset_code\":\"XRP\"," + "\"asset_scale\":6," + "\"max_packet_amount\":10000000,"... | public RustNodeAccount createAccount(RustNodeAccount rustNodeAccount) throws IOException { return execute(requestBuilder() .url(baseUrl.newBuilder().addPathSegment("accounts").build()) .post(RequestBody.create(objectMapper.writeValueAsString(rustNodeAccount), JSON)) .build(), RustNodeAccount.class); } | InterledgerRustNodeClient { public RustNodeAccount createAccount(RustNodeAccount rustNodeAccount) throws IOException { return execute(requestBuilder() .url(baseUrl.newBuilder().addPathSegment("accounts").build()) .post(RequestBody.create(objectMapper.writeValueAsString(rustNodeAccount), JSON)) .build(), RustNodeAccount... | InterledgerRustNodeClient { public RustNodeAccount createAccount(RustNodeAccount rustNodeAccount) throws IOException { return execute(requestBuilder() .url(baseUrl.newBuilder().addPathSegment("accounts").build()) .post(RequestBody.create(objectMapper.writeValueAsString(rustNodeAccount), JSON)) .build(), RustNodeAccount... | InterledgerRustNodeClient { public RustNodeAccount createAccount(RustNodeAccount rustNodeAccount) throws IOException { return execute(requestBuilder() .url(baseUrl.newBuilder().addPathSegment("accounts").build()) .post(RequestBody.create(objectMapper.writeValueAsString(rustNodeAccount), JSON)) .build(), RustNodeAccount... | InterledgerRustNodeClient { public RustNodeAccount createAccount(RustNodeAccount rustNodeAccount) throws IOException { return execute(requestBuilder() .url(baseUrl.newBuilder().addPathSegment("accounts").build()) .post(RequestBody.create(objectMapper.writeValueAsString(rustNodeAccount), JSON)) .build(), RustNodeAccount... |
@Test public void getBalance() { String bigBalance = "12345678901234567890.11111"; String testClient = "testClient"; stubFor(get(urlEqualTo("/accounts/" + testClient + "/balance")) .withHeader("Authorization", equalTo("Bearer passwordin")) .willReturn(aResponse() .withStatus(200) .withBody("{\"balance\":\"" + bigBalanc... | public BigDecimal getBalance(String accountName) throws SpspClientException { return execute(requestBuilder() .url( baseUrl.newBuilder().addPathSegment("accounts").addPathSegment(accountName).addPathSegment("balance").build() ) .get() .build(), BalanceResponse.class) .getBalance(); } | InterledgerRustNodeClient { public BigDecimal getBalance(String accountName) throws SpspClientException { return execute(requestBuilder() .url( baseUrl.newBuilder().addPathSegment("accounts").addPathSegment(accountName).addPathSegment("balance").build() ) .get() .build(), BalanceResponse.class) .getBalance(); } } | InterledgerRustNodeClient { public BigDecimal getBalance(String accountName) throws SpspClientException { return execute(requestBuilder() .url( baseUrl.newBuilder().addPathSegment("accounts").addPathSegment(accountName).addPathSegment("balance").build() ) .get() .build(), BalanceResponse.class) .getBalance(); } @Deprec... | InterledgerRustNodeClient { public BigDecimal getBalance(String accountName) throws SpspClientException { return execute(requestBuilder() .url( baseUrl.newBuilder().addPathSegment("accounts").addPathSegment(accountName).addPathSegment("balance").build() ) .get() .build(), BalanceResponse.class) .getBalance(); } @Deprec... | InterledgerRustNodeClient { public BigDecimal getBalance(String accountName) throws SpspClientException { return execute(requestBuilder() .url( baseUrl.newBuilder().addPathSegment("accounts").addPathSegment(accountName).addPathSegment("balance").build() ) .get() .build(), BalanceResponse.class) .getBalance(); } @Deprec... |
@Test public void getStreamConnectionDetailsFromPaymentPointer() { String testClient = "testClient"; String sharedSecret = "Nf9wCXI1OZLM/QIWdZZ2Q39limh6+Yxhm/FB1bUpZLA="; String wiremockIlpAddress = "test.wiremock"; stubFor(get(urlEqualTo("/" + testClient)) .withHeader("Accept", equalTo(SpspClient.APPLICATION_SPSP4_JSO... | @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... |
@Test public void getStreamConnectionDetailsFromUrl() { String testClient = "testClient"; String sharedSecret = "Nf9wCXI1OZLM/QIWdZZ2Q39limh6+Yxhm/FB1bUpZLA="; String wiremockIlpAddress = "test.wiremock"; stubFor(get(urlEqualTo("/" + testClient)) .withHeader("Accept", equalTo(SpspClient.APPLICATION_SPSP4_JSON_VALUE)) .... | @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... |
@Test(expected = InvalidReceiverClientException.class) public void getStreamConnectionDetails404ThrowsInvalidReceiver() { String testClient = "testClient"; stubFor(get(urlEqualTo("/" + testClient)) .withHeader("Accept", equalTo(SpspClient.APPLICATION_SPSP4_JSON_VALUE)) .willReturn(aResponse() .withStatus(404) )); clien... | @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... |
@Test(expected = SpspClientException.class) public void getStreamConnectionDetails500ThrowsSpspClientException() { String testClient = "testClient"; stubFor(get(urlEqualTo("/" + testClient)) .withHeader("Accept", equalTo(SpspClient.APPLICATION_SPSP4_JSON_VALUE)) .willReturn(aResponse() .withStatus(503) )); client.getSt... | @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } } | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... | SimpleSpspClient implements SpspClient { @Override public StreamConnectionDetails getStreamConnectionDetails(final PaymentPointer paymentPointer) throws InvalidReceiverClientException { Objects.requireNonNull(paymentPointer); return getStreamConnectionDetails(paymentPointerResolver.resolveHttpUrl(paymentPointer)); } Si... |
@Test public void mapFulfill() { ResponseWrapper wrapper = new ResponseWrapperMapper().map(fulfillPacket); assertThat(wrapper.get()).isEqualTo(fulfillPacket); } | public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(response... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... |
@Test(expected = CodecException.class) public void onTypeIdChangedToUnsupported() { try { codec.onTypeIdChanged((short) 50); Assert.fail(); } catch (CodecException e) { assertThat(e.getMessage()).isEqualTo("Unknown IL-DCP packet type code: 50"); throw e; } } | protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePacketDataCodec())); return; default: throw new Code... | AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePa... | AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePa... | AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePa... | AsnIldcpPacketCodec extends AsnSequenceCodec<T> { protected void onTypeIdChanged(int typeId) { switch (typeId) { case IldcpPacketTypes.REQUEST: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpRequestPacketDataCodec())); return; case IldcpPacketTypes.RESPONSE: setCodecAt(1, new AsnOpenTypeCodec<>(new AsnIldcpResponsePa... |
@Test public void mapReject() { ResponseWrapper wrapper = new ResponseWrapperMapper().map(rejectPacket); assertThat(wrapper.get()).isEqualTo(rejectPacket); } | public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(response... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... |
@Test public void cannotMap() { expectedException.expect(RuntimeException.class); expectedException.expectMessage("Unsupported IldcpResponsePacket Type: " + "class org.interledger.ildcp.InterledgerShampooPacketBuilder$ImmutableInterledgerShampooPacket"); new ResponseWrapperMapper().map(shampooPacket); } | public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(response... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... | IldcpResponsePacketMapper { public final T map(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (InterledgerFulfillPacket.class.isAssignableFrom(responsePacket.getClass())) { return mapFulfillPacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.cla... |
@Test(expected = NullPointerException.class) public void handleNullPacket() { new IldcpResponsePacketHandler() { @Override protected void handleIldcpResponsePacket(IldcpResponsePacket ildcpResponsePacket) { throw new RuntimeException("Should not fulfill!"); } @Override protected void handleIldcpErrorPacket(InterledgerR... | public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(respo... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... |
@Test public void handleFulfillPacket() { new IldcpResponsePacketHandler() { @Override protected void handleIldcpResponsePacket(IldcpResponsePacket ildcpResponsePacket) { assertThat(ildcpResponsePacket).isEqualTo(fulfillPacket); } @Override protected void handleIldcpErrorPacket(InterledgerRejectPacket ildcpErrorPacket)... | public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(respo... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... |
@Test public void handleRejectPacket() { new IldcpResponsePacketHandler() { @Override protected void handleIldcpResponsePacket(IldcpResponsePacket ildcpResponsePacket) { fail("Cannot handle reject packet"); throw new RuntimeException("Should not fulfill!"); } @Override protected void handleIldcpErrorPacket(InterledgerR... | public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(respo... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... |
@Test public void handleExpiredPacket() { new IldcpResponsePacketHandler() { @Override protected void handleIldcpResponsePacket(IldcpResponsePacket ildcpResponsePacket) { fail("Cannot handle expired packet"); throw new RuntimeException("Should not fulfill!"); } @Override protected void handleIldcpErrorPacket(Interledge... | public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(respo... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... |
@Test public void fallthrough() { expectedException.expect(RuntimeException.class); expectedException.expectMessage("Unsupported IldcpResponsePacket Type: " + "class org.interledger.ildcp.InterledgerShampooPacketBuilder$ImmutableInterledgerShampooPacket"); new IldcpResponsePacketHandler() { @Override protected void han... | public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket.class.isAssignableFrom(respo... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... | IldcpResponsePacketHandler { public final void handle(final InterledgerResponsePacket responsePacket) { Objects.requireNonNull(responsePacket); if (IldcpResponsePacket.class.isAssignableFrom(responsePacket.getClass())) { handleIldcpResponsePacket((IldcpResponsePacket) responsePacket); } else if (InterledgerRejectPacket... |
@Test public void hasInFlight() { controller.prepare(UnsignedLong.ONE); assertThat(controller.hasInFlight()).isTrue(); } | @Override public boolean hasInFlight() { return is(this.amountInFlight.get()).greaterThan(UnsignedLong.ZERO); } | AimdCongestionController implements CongestionController { @Override public boolean hasInFlight() { return is(this.amountInFlight.get()).greaterThan(UnsignedLong.ZERO); } } | AimdCongestionController implements CongestionController { @Override public boolean hasInFlight() { return is(this.amountInFlight.get()).greaterThan(UnsignedLong.ZERO); } AimdCongestionController(); AimdCongestionController(
final UnsignedLong startAmount, final UnsignedLong increaseAmount, final BigDecimal decr... | AimdCongestionController implements CongestionController { @Override public boolean hasInFlight() { return is(this.amountInFlight.get()).greaterThan(UnsignedLong.ZERO); } AimdCongestionController(); AimdCongestionController(
final UnsignedLong startAmount, final UnsignedLong increaseAmount, final BigDecimal decr... | AimdCongestionController implements CongestionController { @Override public boolean hasInFlight() { return is(this.amountInFlight.get()).greaterThan(UnsignedLong.ZERO); } AimdCongestionController(); AimdCongestionController(
final UnsignedLong startAmount, final UnsignedLong increaseAmount, final BigDecimal decr... |
@Test public void handleF08RejectionWithNullPrepareAmount() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("prepareAmount must not be null"); controller.handleF08Rejection(null, mock(InterledgerRejectPacket.class)); } | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithNoData() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(); assertThat(controller.handleF08Rejection(UnsignedLong.ZERO, rejectPacket)).isEqualTo(UnsignedLong.ONE); assertThat(controller.handleF08Rejection(UnsignedLong.ONE, rejectPacket)).isEqualTo(UnsignedLong.ON... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void encode() { codec.encode(packet); assertThat((UnsignedLong) codec.getValueAt(0)).isEqualTo(UnsignedLong.ZERO); assertThat((Instant) codec.getValueAt(1)).isEqualTo(NOW); assertThat((InterledgerCondition) codec.getValueAt(2)) .isEqualTo(IldcpRequestPacket.EXECUTION_CONDITION); assertThat((InterledgerAddr... | @Override public void encode(IldcpRequestPacket value) { setValueAt(0, value.getAmount()); setValueAt(1, value.getExpiresAt()); setValueAt(2, value.getExecutionCondition()); setValueAt(3, value.getDestination()); setValueAt(4, value.getData()); } | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public void encode(IldcpRequestPacket value) { setValueAt(0, value.getAmount()); setValueAt(1, value.getExpiresAt()); setValueAt(2, value.getExecutionCondition()); setValueAt(3, value.getDestination()); setValueAt(4, value.getData()... | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public void encode(IldcpRequestPacket value) { setValueAt(0, value.getAmount()); setValueAt(1, value.getExpiresAt()); setValueAt(2, value.getExecutionCondition()); setValueAt(3, value.getDestination()); setValueAt(4, value.getData()... | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public void encode(IldcpRequestPacket value) { setValueAt(0, value.getAmount()); setValueAt(1, value.getExpiresAt()); setValueAt(2, value.getExecutionCondition()); setValueAt(3, value.getDestination()); setValueAt(4, value.getData()... | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public void encode(IldcpRequestPacket value) { setValueAt(0, value.getAmount()); setValueAt(1, value.getExpiresAt()); setValueAt(2, value.getExecutionCondition()); setValueAt(3, value.getDestination()); setValueAt(4, value.getData()... |
@Test public void handleF08RejectionWithGarbageData() { InterledgerRejectPacket rejectPacket = InterledgerRejectPacket.builder().from(interledgerRejectPacket()) .data(new byte[32]).build(); assertThat(controller.handleF08Rejection(UnsignedLong.ZERO, rejectPacket)).isEqualTo(UnsignedLong.ONE); assertThat(controller.hand... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithPrepareLessThanMax() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.valueOf(2L)) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller.handleF08Rejection(UnsignedLo... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithPrepareEqualToMax() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.valueOf(2L)) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller.handleF08Rejection(UnsignedLon... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithPrepareGreaterThanMax() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.valueOf(2L)) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller.handleF08Rejection(ONE_K, ... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithPrepareGreaterThanMaxWithRoundingDownBelowPoint5() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.valueOf(3L)) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithPrepareGreaterThanMaxWithRoundingDownAbovePoint5() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.valueOf(7L)) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionWithDivergentMaxReceived() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(ONE_K) .maximumAmount(UnsignedLong.valueOf(2L)) .build() )); assertThat(controller.handleF08Rejection(ONE_K, rejectPacket)).isEqu... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void handleF08RejectionDivideByZeroHalves() { InterledgerRejectPacket rejectPacket = interledgerRejectPacket(Optional.of( AmountTooLargeErrorData.builder() .receivedAmount(UnsignedLong.ZERO) .maximumAmount(UnsignedLong.valueOf(10L)) .build() )); assertThat(controller.handleF08Rejection(ONE_K, rejectPacket)... | @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectPacket must not be null"); UnsignedLong newMaxPacketAmount; ... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... | AimdCongestionController implements CongestionController { @VisibleForTesting protected UnsignedLong handleF08Rejection( final UnsignedLong prepareAmount, final InterledgerRejectPacket rejectPacket ) { Objects.requireNonNull(prepareAmount, "prepareAmount must not be null"); Objects.requireNonNull(rejectPacket, "rejectP... |
@Test public void openConnection() { StreamConnectionId streamConnectionId = StreamConnectionId.of("foo"); final StreamConnection streamConnection = streamConnectionManager .openConnection(streamConnectionId); assertThat(streamConnectionManager.openConnection(streamConnectionId)).isEqualTo(streamConnection); assertThat... | public StreamConnection openConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return connections.computeIfAbsent(streamConnectionId, StreamConnection::new); } | StreamConnectionManager { public StreamConnection openConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return connections.computeIfAbsent(streamConnectionId, StreamConnection::new); } } | StreamConnectionManager { public StreamConnection openConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return connections.computeIfAbsent(streamConnectionId, StreamConnection::new); } } | StreamConnectionManager { public StreamConnection openConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return connections.computeIfAbsent(streamConnectionId, StreamConnection::new); } StreamConnection openConnection(final StreamConnectionId streamConnectionId); Opti... | StreamConnectionManager { public StreamConnection openConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return connections.computeIfAbsent(streamConnectionId, StreamConnection::new); } StreamConnection openConnection(final StreamConnectionId streamConnectionId); Opti... |
@Test public void closeConnection() { StreamConnectionId streamConnectionId = StreamConnectionId.of("foo"); final StreamConnection streamConnection = streamConnectionManager .openConnection(streamConnectionId); assertThat(streamConnectionManager.closeConnection(streamConnectionId)).get().isEqualTo(streamConnection); as... | public Optional<StreamConnection> closeConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return Optional.ofNullable(connections.get(streamConnectionId)) .map(connectionToClose -> { connectionToClose.closeConnection(); return connectionToClose; }); } | StreamConnectionManager { public Optional<StreamConnection> closeConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return Optional.ofNullable(connections.get(streamConnectionId)) .map(connectionToClose -> { connectionToClose.closeConnection(); return connectionToClose... | StreamConnectionManager { public Optional<StreamConnection> closeConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return Optional.ofNullable(connections.get(streamConnectionId)) .map(connectionToClose -> { connectionToClose.closeConnection(); return connectionToClose... | StreamConnectionManager { public Optional<StreamConnection> closeConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return Optional.ofNullable(connections.get(streamConnectionId)) .map(connectionToClose -> { connectionToClose.closeConnection(); return connectionToClose... | StreamConnectionManager { public Optional<StreamConnection> closeConnection(final StreamConnectionId streamConnectionId) { Objects.requireNonNull(streamConnectionId); return Optional.ofNullable(connections.get(streamConnectionId)) .map(connectionToClose -> { connectionToClose.closeConnection(); return connectionToClose... |
@Test public void decode() throws IOException { final ByteArrayOutputStream os = new ByteArrayOutputStream(); IldcpCodecContextFactory.oer().write(packet, os); final IldcpRequestPacket actual = IldcpCodecContextFactory.oer() .read(IldcpRequestPacket.class, new ByteArrayInputStream(os.toByteArray())); assertThat(actual)... | @Override public IldcpRequestPacket decode() { return IldcpRequestPacket.builder() .amount(getValueAt(0)) .expiresAt(getValueAt(1)) .build(); } | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public IldcpRequestPacket decode() { return IldcpRequestPacket.builder() .amount(getValueAt(0)) .expiresAt(getValueAt(1)) .build(); } } | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public IldcpRequestPacket decode() { return IldcpRequestPacket.builder() .amount(getValueAt(0)) .expiresAt(getValueAt(1)) .build(); } AsnIldcpRequestPacketDataCodec(); } | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public IldcpRequestPacket decode() { return IldcpRequestPacket.builder() .amount(getValueAt(0)) .expiresAt(getValueAt(1)) .build(); } AsnIldcpRequestPacketDataCodec(); @Override IldcpRequestPacket decode(); @Override void encode(Ild... | AsnIldcpRequestPacketDataCodec extends AsnSequenceCodec<IldcpRequestPacket> { @Override public IldcpRequestPacket decode() { return IldcpRequestPacket.builder() .amount(getValueAt(0)) .expiresAt(getValueAt(1)) .build(); } AsnIldcpRequestPacketDataCodec(); @Override IldcpRequestPacket decode(); @Override void encode(Ild... |
@Test public void testEncryptToSameRustJs() { byte[] encryptedValue = streamEncryptionService.encryptWithIv(SHARED_SECRET, PLAINTEXT, NONCE_IV); assertThat(encryptedValue).isEqualTo(CIPHERTEXT); } | @VisibleForTesting byte[] encryptWithIv(final SharedSecret sharedSecret, final byte[] plainText, final byte[] iv) throws EncryptionException { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(plainText); Objects.requireNonNull(iv); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { return thi... | AesGcmStreamEncryptionService implements StreamEncryptionService { @VisibleForTesting byte[] encryptWithIv(final SharedSecret sharedSecret, final byte[] plainText, final byte[] iv) throws EncryptionException { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(plainText); Objects.requireNonNull(iv); if (this.... | AesGcmStreamEncryptionService implements StreamEncryptionService { @VisibleForTesting byte[] encryptWithIv(final SharedSecret sharedSecret, final byte[] plainText, final byte[] iv) throws EncryptionException { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(plainText); Objects.requireNonNull(iv); if (this.... | AesGcmStreamEncryptionService implements StreamEncryptionService { @VisibleForTesting byte[] encryptWithIv(final SharedSecret sharedSecret, final byte[] plainText, final byte[] iv) throws EncryptionException { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(plainText); Objects.requireNonNull(iv); if (this.... | AesGcmStreamEncryptionService implements StreamEncryptionService { @VisibleForTesting byte[] encryptWithIv(final SharedSecret sharedSecret, final byte[] plainText, final byte[] iv) throws EncryptionException { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(plainText); Objects.requireNonNull(iv); if (this.... |
@Test public void testDecryptToSameAsRustJs() { byte[] decryptedValue = streamEncryptionService.decrypt(SHARED_SECRET, CIPHERTEXT); assertThat(decryptedValue).isEqualTo(PLAINTEXT); } | @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return this.nonStandardModeDecrypt(sharedSecret, cipherMessage); } catch (En... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... |
@Test public void testDecryptToSameAsRustJsInStandardMode() { this.streamEncryptionService = new AesGcmStreamEncryptionService(EncryptionMode.ENCRYPT_STANDARD); byte[] decryptedValue = streamEncryptionService.decrypt(SHARED_SECRET, CIPHERTEXT); assertThat(decryptedValue).isEqualTo(PLAINTEXT); } | @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return this.nonStandardModeDecrypt(sharedSecret, cipherMessage); } catch (En... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... | AesGcmStreamEncryptionService implements StreamEncryptionService { @Override public byte[] decrypt(final SharedSecret sharedSecret, final byte[] cipherMessage) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(cipherMessage); if (this.encryptionMode == EncryptionMode.ENCRYPT_NON_STANDARD) { try { return th... |
@Test public void testConstructorWithAddressAndSecret() { streamConnection = new StreamConnection(InterledgerAddress.of("example.foo"), SharedSecret.of(new byte[32])); assertThat(streamConnection.getStreamConnectionId()) .isEqualTo(StreamConnectionId.of("246307596a10c1ba057f56cd6d588ed0d11cf3f8817c937265e93950af53751f"... | public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCr... | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCr... |
@Test public void testStreamConnectionId() { StreamConnectionId streamConnectionId = StreamConnectionId.of("foo"); assertThat(new StreamConnection(streamConnectionId).getStreamConnectionId()).isEqualTo(streamConnectionId); } | public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); } | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCr... | StreamConnection implements Closeable { public StreamConnectionId getStreamConnectionId() { return streamConnectionId; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCr... |
@Test public void nextSequence() throws StreamConnectionClosedException { assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.ONE); assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.valueOf(2L)); assertThat(streamConnection.nextSequence()).isEqualTo(UnsignedLong.valueOf(3L)); assertThat(... | public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamC... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... |
@Test public void nextSequenceMultiThreaded() throws StreamConnectionClosedException { final List<CompletableFuture<UnsignedLong>> allFutures = Lists.newArrayList(); final int numRepetitions = 50000; final ExecutorService executorService = Executors.newFixedThreadPool(10); for (int i = 0; i < numRepetitions; i++) { all... | public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { this.closeConnection(); throw new StreamC... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... | StreamConnection implements Closeable { public UnsignedLong nextSequence() throws StreamConnectionClosedException { final UnsignedLong nextSequence = sequence.getAndUpdate(currentSequence -> currentSequence.plus(UnsignedLong.ONE)); if (sequenceIsSafeForSingleSharedSecret(nextSequence)) { return nextSequence; } else { t... |
@Test public void transitionConnectionState() { assertThat(streamConnection.isClosed()).isFalse(); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.AVAILABLE); assertThat(streamConnection.getConnectionState()).isEqualTo(StreamConnectionState.AVAILABLE); streamConnection.transitionConnec... | public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } | StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } } | StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } StreamC... | StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } StreamC... | StreamConnection implements Closeable { public void transitionConnectionState() { this.connectionState.updateAndGet(streamConnectionState -> { switch (streamConnectionState) { case AVAILABLE: { return StreamConnectionState.OPEN; } case OPEN: case CLOSED: default: { return StreamConnectionState.CLOSED; } } }); } StreamC... |
@Test public void getCreationDateTime() { assertThat(streamConnection.getCreationDateTime()).isNotNull(); assertThat(streamConnection.getCreationDateTime()).isBefore(DateUtils.now().plusSeconds(1)); } | public Instant getCreationDateTime() { return creationDateTime; } | StreamConnection implements Closeable { public Instant getCreationDateTime() { return creationDateTime; } } | StreamConnection implements Closeable { public Instant getCreationDateTime() { return creationDateTime; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); } | StreamConnection implements Closeable { public Instant getCreationDateTime() { return creationDateTime; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationDateTime(... | StreamConnection implements Closeable { public Instant getCreationDateTime() { return creationDateTime; } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationDateTime(... |
@Test public void testEquals() { assertThat(streamConnection.equals(null)).isFalse(); assertThat(streamConnection.equals(streamConnection)).isTrue(); StreamConnection identicalStreamConnection = new StreamConnection(StreamConnectionId.of("foo")); assertThat(streamConnection.equals(identicalStreamConnection)).isTrue(); ... | @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StreamConnection that = (StreamConnection) obj; return streamConnectionId.equals(that.streamConnectionId); } | StreamConnection implements Closeable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StreamConnection that = (StreamConnection) obj; return streamConnectionId.equals(that.streamConnectionId); } } | StreamConnection implements Closeable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StreamConnection that = (StreamConnection) obj; return streamConnectionId.equals(that.streamConnectionId); } StreamConnection(final I... | StreamConnection implements Closeable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StreamConnection that = (StreamConnection) obj; return streamConnectionId.equals(that.streamConnectionId); } StreamConnection(final I... | StreamConnection implements Closeable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StreamConnection that = (StreamConnection) obj; return streamConnectionId.equals(that.streamConnectionId); } StreamConnection(final I... |
@Test public void read() throws Exception { final ByteArrayInputStream inputStream = new ByteArrayInputStream(this.asn1OerBytes); final int actualPayloadLength = OerLengthSerializer.readLength(inputStream); assertThat(actualPayloadLength).isEqualTo(expectedPayloadLength); } | public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } else { final int lengthOf... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... |
@Test public void testHashCode() { StreamConnection identicalStreamConnection = new StreamConnection(StreamConnectionId.of("foo")); assertThat(streamConnection.hashCode()).isEqualTo(identicalStreamConnection.hashCode()); StreamConnection nonIdenticalStreamConnection = new StreamConnection(StreamConnectionId.of("foo1"))... | @Override public int hashCode() { return streamConnectionId.hashCode(); } | StreamConnection implements Closeable { @Override public int hashCode() { return streamConnectionId.hashCode(); } } | StreamConnection implements Closeable { @Override public int hashCode() { return streamConnectionId.hashCode(); } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); } | StreamConnection implements Closeable { @Override public int hashCode() { return streamConnectionId.hashCode(); } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationD... | StreamConnection implements Closeable { @Override public int hashCode() { return streamConnectionId.hashCode(); } StreamConnection(final InterledgerAddress receiverAddress, final SharedSecret sharedSecret); StreamConnection(final StreamConnectionId streamConnectionId); UnsignedLong nextSequence(); Instant getCreationD... |
@Test public void testToString() { final String matchingSerializedRegex = "StreamConnection\\[" + "creationDateTime=[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.\\d+Z, " + "streamConnectionId=\\S+ sequence=\\d+, connectionState=[A-Z]+]"; final String serializedStreamConnection = streamConnection.toString()... | @Override public String toString() { return new StringJoiner(", ", StreamConnection.class.getSimpleName() + "[", "]") .add("creationDateTime=" + creationDateTime) .add("streamConnectionId=" + streamConnectionId) .add("sequence=" + sequence) .add("connectionState=" + connectionState) .toString(); } | StreamConnection implements Closeable { @Override public String toString() { return new StringJoiner(", ", StreamConnection.class.getSimpleName() + "[", "]") .add("creationDateTime=" + creationDateTime) .add("streamConnectionId=" + streamConnectionId) .add("sequence=" + sequence) .add("connectionState=" + connectionSta... | StreamConnection implements Closeable { @Override public String toString() { return new StringJoiner(", ", StreamConnection.class.getSimpleName() + "[", "]") .add("creationDateTime=" + creationDateTime) .add("streamConnectionId=" + streamConnectionId) .add("sequence=" + sequence) .add("connectionState=" + connectionSta... | StreamConnection implements Closeable { @Override public String toString() { return new StringJoiner(", ", StreamConnection.class.getSimpleName() + "[", "]") .add("creationDateTime=" + creationDateTime) .add("streamConnectionId=" + streamConnectionId) .add("sequence=" + sequence) .add("connectionState=" + connectionSta... | StreamConnection implements Closeable { @Override public String toString() { return new StringJoiner(", ", StreamConnection.class.getSimpleName() + "[", "]") .add("creationDateTime=" + creationDateTime) .add("streamConnectionId=" + streamConnectionId) .add("sequence=" + sequence) .add("connectionState=" + connectionSta... |
@Test public void generatedFulfillableFulfillment() { InterledgerFulfillment fulfillment = StreamUtils.generatedFulfillableFulfillment(SHARED_SECRET, DATA); assertThat(fulfillment.getPreimage()).isEqualTo(FULFILLMENT); assertThat(fulfillment).isEqualTo(InterledgerFulfillment.of(FULFILLMENT)); } | public static InterledgerFulfillment generatedFulfillableFulfillment( final SharedSecret sharedSecret, final byte[] data ) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(data); final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME); final byte[] hmacKey = Hashing.hmacSha... | StreamUtils { public static InterledgerFulfillment generatedFulfillableFulfillment( final SharedSecret sharedSecret, final byte[] data ) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(data); final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME); final byte[] hmacKey = H... | StreamUtils { public static InterledgerFulfillment generatedFulfillableFulfillment( final SharedSecret sharedSecret, final byte[] data ) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(data); final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME); final byte[] hmacKey = H... | StreamUtils { public static InterledgerFulfillment generatedFulfillableFulfillment( final SharedSecret sharedSecret, final byte[] data ) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(data); final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME); final byte[] hmacKey = H... | StreamUtils { public static InterledgerFulfillment generatedFulfillableFulfillment( final SharedSecret sharedSecret, final byte[] data ) { Objects.requireNonNull(sharedSecret); Objects.requireNonNull(data); final SecretKey secretKey = new SecretKeySpec(sharedSecret.key(), HMAC_SHA256_ALG_NAME); final byte[] hmacKey = H... |
@Test(expected = NullPointerException.class) public void minWithNullFirst() { try { StreamUtils.min(null, UnsignedLong.ONE); fail(); } catch (NullPointerException e) { assertThat(e.getMessage()).isNull(); throw e; } } | public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... |
@Test(expected = NullPointerException.class) public void minWithNullSecond() { try { StreamUtils.min(UnsignedLong.ONE, null); fail(); } catch (NullPointerException e) { assertThat(e.getMessage()).isNull(); throw e; } } | public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... |
@Test public void minTests() { assertThat(StreamUtils.min(UnsignedLong.ZERO, UnsignedLong.ZERO)).isEqualTo(UnsignedLong.ZERO); assertThat(StreamUtils.min(UnsignedLong.ONE, UnsignedLong.ZERO)).isEqualTo(UnsignedLong.ZERO); assertThat(StreamUtils.min(UnsignedLong.ZERO, UnsignedLong.ONE)).isEqualTo(UnsignedLong.ZERO); ass... | public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... | StreamUtils { public static UnsignedLong min(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).lessThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerFulf... |
@Test public void maxTests() { assertThat(StreamUtils.max(UnsignedLong.ZERO, UnsignedLong.ZERO)).isEqualTo(UnsignedLong.ZERO); assertThat(StreamUtils.max(UnsignedLong.ONE, UnsignedLong.ZERO)).isEqualTo(UnsignedLong.ONE); assertThat(StreamUtils.max(UnsignedLong.ZERO, UnsignedLong.ONE)).isEqualTo(UnsignedLong.ONE); asser... | public static UnsignedLong max(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).greaterThan(value2)) { return value1; } else { return value2; } } | StreamUtils { public static UnsignedLong max(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).greaterThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong max(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).greaterThan(value2)) { return value1; } else { return value2; } } } | StreamUtils { public static UnsignedLong max(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).greaterThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerF... | StreamUtils { public static UnsignedLong max(final UnsignedLong value1, final UnsignedLong value2) { Objects.requireNonNull(value1); Objects.requireNonNull(value2); if (is(value1).greaterThan(value2)) { return value1; } else { return value2; } } static InterledgerCondition unfulfillableCondition(); static InterledgerF... |
@Test public void unfulfillableCondition() { assertThat(StreamUtils.unfulfillableCondition()).isNotNull(); assertThat(StreamUtils.unfulfillableCondition()).isNotEqualTo(InterledgerCondition.of(new byte[32])); } | public static InterledgerCondition unfulfillableCondition() { return InterledgerCondition.of(Random.randBytes(32)); } | StreamUtils { public static InterledgerCondition unfulfillableCondition() { return InterledgerCondition.of(Random.randBytes(32)); } } | StreamUtils { public static InterledgerCondition unfulfillableCondition() { return InterledgerCondition.of(Random.randBytes(32)); } } | StreamUtils { public static InterledgerCondition unfulfillableCondition() { return InterledgerCondition.of(Random.randBytes(32)); } static InterledgerCondition unfulfillableCondition(); static InterledgerFulfillment generatedFulfillableFulfillment(
final SharedSecret sharedSecret, final byte[] data
); static U... | StreamUtils { public static InterledgerCondition unfulfillableCondition() { return InterledgerCondition.of(Random.randBytes(32)); } static InterledgerCondition unfulfillableCondition(); static InterledgerFulfillment generatedFulfillableFulfillment(
final SharedSecret sharedSecret, final byte[] data
); static U... |
@Test public void calculateMinAmountToAcceptInReceiverAmountMode() { ExchangeRateCalculator calc = new NoOpExchangeRateCalculator(); assertThat(calc.calculateMinAmountToAccept(UnsignedLong.ONE, Denominations.USD, Denominations.EUR)) .isEqualTo(UnsignedLong.ZERO); } | @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } @Override... | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } @Override... |
@Test public void calculateMinAmountToAcceptInSenderAmountMode() { ExchangeRateCalculator calc = new NoOpExchangeRateCalculator(); assertThat(calc.calculateMinAmountToAccept(UnsignedLong.ONE, Denominations.USD)) .isEqualTo(UnsignedLong.ZERO); } | @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } } | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } @Override... | NoOpExchangeRateCalculator implements ExchangeRateCalculator { @Override public UnsignedLong calculateMinAmountToAccept( final UnsignedLong sendAmount, final Denomination sendAmountDenomination ) { Objects.requireNonNull(sendAmount); Objects.requireNonNull(sendAmountDenomination); return UnsignedLong.ZERO; } @Override... |
@Test public void write() throws Exception { final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); OerLengthSerializer.writeLength(expectedPayloadLength, outputStream); assertThat(this.asn1OerBytes).isEqualTo(outputStream.toByteArray()); } | public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.write(length); } else ... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... |
@Test public void setupStream() { StreamConnectionGenerator streamConnectionGenerator = mock(StreamConnectionGenerator.class); this.streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, StreamCodecContextFactory.oer() ); InterledgerAddress receiverAddres... | @Override public StreamConnectionDetails setupStream(final InterledgerAddress receiverAddress) { Objects.requireNonNull(receiverAddress); return streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, receiverAddress); } | StatelessStreamReceiver implements StreamReceiver { @Override public StreamConnectionDetails setupStream(final InterledgerAddress receiverAddress) { Objects.requireNonNull(receiverAddress); return streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, receiverAddress); } } | StatelessStreamReceiver implements StreamReceiver { @Override public StreamConnectionDetails setupStream(final InterledgerAddress receiverAddress) { Objects.requireNonNull(receiverAddress); return streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, receiverAddress); } StatelessStreamReceiver(
... | StatelessStreamReceiver implements StreamReceiver { @Override public StreamConnectionDetails setupStream(final InterledgerAddress receiverAddress) { Objects.requireNonNull(receiverAddress); return streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, receiverAddress); } StatelessStreamReceiver(
... | StatelessStreamReceiver implements StreamReceiver { @Override public StreamConnectionDetails setupStream(final InterledgerAddress receiverAddress) { Objects.requireNonNull(receiverAddress); return streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, receiverAddress); } StatelessStreamReceiver(
... |
@Test public void testFulfillsValidPacketWithTypedData() throws IOException { final ValidPrepareDetails details = constructValidPreparePacket(); final InterledgerPreparePacket preparePacket = details.preparePacketBuilder().build(); final InterledgerAddress receiverAddress = details.receiverAddress(); final InterledgerC... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void testFulfillsValidPacketWithNoTypedData() throws IOException { final ValidPrepareDetails details = constructValidPreparePacket(); final InterledgerPreparePacket preparePacket = details.preparePacketBuilder().typedData(Optional.empty()).build(); final InterledgerAddress receiverAddress = details.receive... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void returnsAssetDetailsOnNewConnection() throws IOException { streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, StreamCodecContextFactory.oer() ); final InterledgerAddress receiverAddress = InterledgerAddress.of("example.receiver"); fin... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyRejectsOnDecryption() throws Exception { this.streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, mockCodecContext ); when(mockCodecContext.read(any(), any())).thenThrow(new IOException()); InterledgerRejectPacket expected... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyThrowsOnWriteFailureWhenFulfillable() throws Exception { this.streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, mockCodecContext ); when(mockCodecContext.read(any(), any())).thenAnswer((Answer<StreamPacket>) invocation -... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyThrowsOnWriteFailureWhenUnfulfillable() throws Exception { this.connectionDetails = streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, CLIENT_ADDRESS); final SharedSecret sharedSecret = SharedSecret.of(connectionDetails.sharedSecret().key()); this.streamReceiver = ne... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyWithUnfulfillablePrepareRejects() throws Exception { this.connectionDetails = streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, CLIENT_ADDRESS); final SharedSecret sharedSecret = SharedSecret.of(connectionDetails.sharedSecret().key()); streamReceiver = new Stateless... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyWithEmptyStreamPacketRejects() { this.connectionDetails = streamConnectionGenerator.generateConnectionDetails(serverSecretSupplier, CLIENT_ADDRESS); streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, StreamCodecContextFac... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void receiveMoneyWithSequenceTooHighForSafeEncryption() throws Exception { streamReceiver = new StatelessStreamReceiver( serverSecretSupplier, streamConnectionGenerator, streamEncryptionService, StreamCodecContextFactory.oer() ); final InterledgerAddress receiverAddress = InterledgerAddress.of("example.rec... | @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final SharedSecret spspSharedSecret = this.streamConnection... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... | StatelessStreamReceiver implements StreamReceiver { @Override public InterledgerResponsePacket receiveMoney( final InterledgerPreparePacket preparePacket, final InterledgerAddress receiverAddress, final Denomination denomination ) { Objects.requireNonNull(preparePacket); Objects.requireNonNull(receiverAddress); final S... |
@Test public void writeNegativeLength() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); OerLengthSerializer.writeLength(Integer.MIN_VALUE, outputStream); assertThat(BaseEncoding.base16().decode("00")).isEqualTo(outputStream.toByteArray()); outputStream = new ByteArrayOutputStream(... | public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.write(length); } else ... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... | OerLengthSerializer { public static void writeLength(final int length, final OutputStream outputStream) throws IOException { Objects.requireNonNull(outputStream); if (length <= 0) { outputStream.write(0); } else { if (length >= 0 && length < 128) { outputStream.write(length); } else { if (length <= 127) { outputStream.... |
@Test public void readLengthWithCorrectPrefixButNegativeNumber() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(3); for (int i = 0; i < 3; i++) { outputStream.write(-1); } ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); ... | public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } else { final int lengthOf... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... |
@Test public void readMultiByteLengthWithNegativeValue() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(-127); outputStream.write(0x80); ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); assertThat(OerLengthSerializer.read... | public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } else { final int lengthOf... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... |
@Test public void readMultiByteLengthWith1Byte() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); outputStream.write(-127); outputStream.write(2); ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); assertThat(OerLengthSerializer.readLength(inpu... | public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } else { final int lengthOf... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... | OerLengthSerializer { public static int readLength(final InputStream inputStream) throws IOException { Objects.requireNonNull(inputStream); final int length; int initialLengthPrefixOctet = inputStream.read(); if (initialLengthPrefixOctet >= 0 && initialLengthPrefixOctet < 128) { length = initialLengthPrefixOctet; } els... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.