org.assertj.core.util.Maps Java Examples
The following examples show how to use
org.assertj.core.util.Maps.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultRequestProcessorTest.java From DDMQ with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #2
Source File: HeaderEntryFiltersTest.java From ditto with Eclipse Public License 2.0 | 6 votes |
@Test public void toExternalHeadersFilterDiscardsDittoInternalAckRequests() { final DittoHeaderDefinition headerDefinition = DittoHeaderDefinition.REQUESTED_ACKS; final Map<String, HeaderDefinition> headerDefinitions = Maps.newHashMap(headerDefinition.getKey(), headerDefinition); final List<AcknowledgementRequest> allAcknowledgementRequests = Lists.list( AcknowledgementRequest.of(AcknowledgementLabel.of("foo")), AcknowledgementRequest.of(DittoAcknowledgementLabel.TWIN_PERSISTED), AcknowledgementRequest.of(AcknowledgementLabel.of("bar"))); final JsonArray allAcknowledgementRequestsJsonArray = allAcknowledgementRequests.stream() .map(AcknowledgementRequest::toString) .map(JsonValue::of) .collect(JsonCollectors.valuesToArray()); final String value = allAcknowledgementRequestsJsonArray.toString(); final JsonArray externalAcknowledgementRequests = allAcknowledgementRequestsJsonArray.toBuilder() .remove(1) .build(); final String expected = externalAcknowledgementRequests.toString(); final HeaderEntryFilter underTest = HeaderEntryFilters.toExternalHeadersFilter(headerDefinitions); assertThat(underTest.apply(headerDefinition.getKey(), value)).isEqualTo(expected); }
Example #3
Source File: DefaultRequestProcessorTest.java From DDMQ with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #4
Source File: DefaultRequestProcessorTest.java From rocketmq_trans_message with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #5
Source File: DefaultRequestProcessorTest.java From rocketmq-all-4.1.0-incubating with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #6
Source File: LambdaTests.java From lion with Apache License 2.0 | 6 votes |
@Test public void test() { // 使用 stream、parallelStream 对集合进行操作 List<String> strings = Arrays.asList("hello tom", "hello jerry", "hello tom", "hello tom", "hello world", "hello jerry"); List<Integer> integers = Arrays.asList(6, 3, 2, 4, 5, 9, 8, 1, 7); integers.stream() .filter(x -> x % 2 == 0) .map(x -> x * 10) .sorted((x, y) -> x > y ? -1 : 1) .forEach(System.out::println); strings.parallelStream() .flatMap(x -> Arrays.stream(x.split(" "))) .map(x -> Maps.newHashMap(x, 1)) //.map(x -> new Tuple2(x, 1)) //.collect(Collectors.groupingBy(Tuple2::_1)); .forEach(System.out::println); }
Example #7
Source File: RouteBuilderTests.java From spring-cloud-gateway with Apache License 2.0 | 6 votes |
@Test public void testRouteOptionsPropagatedToRoute() { Map<String, Object> routeMetadata = Maps.newHashMap("key", "value"); RouteLocator routeLocator = this.routeLocatorBuilder.routes() .route("test1", r -> r.host("*.somehost.org").and().path("/somepath") .filters(f -> f.addRequestHeader("header1", "header-value-1")) .metadata("key", "value").uri("http://someuri")) .route("test2", r -> r.host("*.somehost2.org") .filters(f -> f.addResponseHeader("header-response-1", "header-response-1")) .uri("https://httpbin.org:9090")) .build(); StepVerifier.create(routeLocator.getRoutes()) .expectNextMatches( r -> r.getId().equals("test1") && r.getFilters().size() == 1 && r.getUri().equals(URI.create("http://someuri:80")) && r.getMetadata().equals(routeMetadata)) .expectNextMatches(r -> r.getId().equals("test2") && r.getFilters().size() == 1 && r.getUri().equals(URI.create("https://httpbin.org:9090")) && r.getMetadata().isEmpty()) .expectComplete().verify(); }
Example #8
Source File: DefaultRequestProcessorTest.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #9
Source File: DefaultRequestProcessorTest.java From rocketmq with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #10
Source File: DefaultRequestProcessorTest.java From rocketmq-4.3.0 with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #11
Source File: KubernetesInstanceDiscoveryTest.java From breakerbox with Apache License 2.0 | 6 votes |
@Test public void onlyAcceptsCorrectValuesInPortAnnotation() throws Exception { Pod invalidAnnotation = new Pod(); invalidAnnotation.setMetadata(new ObjectMeta()); invalidAnnotation.setStatus(new PodStatus()); invalidAnnotation.getStatus().setPodIP("10.116.0.8"); invalidAnnotation.getStatus().setPhase("Running"); invalidAnnotation.getMetadata().setAnnotations( Maps.newHashMap(KubernetesInstanceDiscovery.PORT_ANNOTATION_KEY, "invalid-port")); invalidAnnotation.getMetadata().setName("service-invalid-097fsd"); invalidAnnotation.getMetadata().setGenerateName("service-invalid-"); invalidAnnotation.getMetadata().setNamespace("production"); pods.clear(); pods.add(invalidAnnotation); assertThat(discovery.getInstanceList().size()).isEqualTo(0); }
Example #12
Source File: KubernetesInstanceDiscoveryTest.java From breakerbox with Apache License 2.0 | 6 votes |
@Test public void usesPhasePropertyAsInstanceStatus() throws Exception { Pod invalidAnnotation = new Pod(); invalidAnnotation.setMetadata(new ObjectMeta()); invalidAnnotation.setStatus(new PodStatus()); invalidAnnotation.getStatus().setPodIP("10.116.0.8"); invalidAnnotation.getStatus().setPhase("Preparing"); invalidAnnotation.getMetadata().setAnnotations( Maps.newHashMap(KubernetesInstanceDiscovery.PORT_ANNOTATION_KEY, "8080")); invalidAnnotation.getMetadata().setName("service-preparing-097fsd"); invalidAnnotation.getMetadata().setGenerateName("service-preparing-"); invalidAnnotation.getMetadata().setNamespace("production"); pods.add(invalidAnnotation); for (Instance instance: discovery.getInstanceList()) { if (instance.getCluster().equals("production-service-preparing")) assertThat(instance.isUp()).isFalse(); else assertThat(instance.isUp()).isTrue(); } }
Example #13
Source File: DefaultRequestProcessorTest.java From rocketmq-read with Apache License 2.0 | 6 votes |
@Test public void testProcessRequest_RegisterBroker() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #14
Source File: KubernetesInstanceDiscoveryTest.java From breakerbox with Apache License 2.0 | 6 votes |
@Test public void removesPodTemplateHashFromClusterName() throws Exception { Pod deploymentPod = new Pod(); deploymentPod.setMetadata(new ObjectMeta()); deploymentPod.setStatus(new PodStatus()); deploymentPod.getStatus().setPodIP("10.116.0.8"); deploymentPod.getStatus().setPhase("Running"); deploymentPod.getMetadata().setAnnotations( Maps.newHashMap(KubernetesInstanceDiscovery.PORT_ANNOTATION_KEY, "8080")); deploymentPod.getMetadata().setLabels( Maps.newHashMap(KubernetesInstanceDiscovery.POD_HASH_LABEL_KEY, "5432543253")); deploymentPod.getMetadata().setName("service-depl-5432543253-097fsd"); deploymentPod.getMetadata().setGenerateName("service-depl-5432543253-"); deploymentPod.getMetadata().setNamespace("production"); pods.add(deploymentPod); Optional<Instance> instanceOptional = discovery.getInstanceList().stream() .filter(instance -> instance.getCluster().equals("production-service-depl")) .findAny(); assertThat(instanceOptional.isPresent()).isTrue(); }
Example #15
Source File: RouteDefinitionTest.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void addRouteDefinitionKeepsExistingMetadata() { Map<String, Object> originalMetadata = Maps.newHashMap("key", "value"); Map<String, Object> newMetadata = Maps.newHashMap("key2", "value2"); RouteDefinition routeDefinition = new RouteDefinition(); routeDefinition.setMetadata(originalMetadata); routeDefinition.getMetadata().putAll(newMetadata); assertThat(routeDefinition.getMetadata()).hasSize(2) .containsAllEntriesOf(originalMetadata).containsAllEntriesOf(newMetadata); }
Example #16
Source File: FeignTest.java From feign with Apache License 2.0 | 5 votes |
@Test public void arrayQueryMapParams() throws Exception { server.enqueue(new MockResponse().setBody("foo")); TestInterface api = new TestInterfaceBuilder().target("http://localhost:" + server.getPort()); api.queryMapWithArrayValues(Maps.newHashMap("1", new String[] {"apple", "pear"})); assertThat(server.takeRequest()) .hasPath("/?1=apple&1=pear"); }
Example #17
Source File: ImmutableDittoHeadersTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void tryToCheckIfEntriesSizeIsGreaterThanNegativeLong() { final long negativeLong = -3L; final ImmutableDittoHeaders underTest = ImmutableDittoHeaders.of( Maps.newHashMap(DittoHeaderDefinition.CORRELATION_ID.getKey(), KNOWN_CORRELATION_ID)); assertThatExceptionOfType(IllegalArgumentException.class) .isThrownBy(() -> underTest.isEntriesSizeGreaterThan(negativeLong)) .withMessage("The size to compare to must not be negative but it was <%s>!", negativeLong) .withNoCause(); }
Example #18
Source File: ImmutableDittoHeadersTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void entriesSizeIsGreaterThanZeroIfHeadersAreNotEmpty() { final ImmutableDittoHeaders underTest = ImmutableDittoHeaders.of( Maps.newHashMap(DittoHeaderDefinition.CORRELATION_ID.getKey(), KNOWN_CORRELATION_ID)); assertThat(underTest.isEntriesSizeGreaterThan(0)).isTrue(); }
Example #19
Source File: ImmutableDittoHeadersTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void entriesSizeIsNotGreaterThanComparedSize() { final String key = DittoHeaderDefinition.CORRELATION_ID.getKey(); final String value = KNOWN_CORRELATION_ID; final long comparisonSize = key.length() + value.length(); final ImmutableDittoHeaders underTest = ImmutableDittoHeaders.of(Maps.newHashMap(key, value)); assertThat(underTest.isEntriesSizeGreaterThan(comparisonSize)).isFalse(); }
Example #20
Source File: ImmutableDittoHeadersTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void entriesSizeIsGreaterThanComparedSize() { final String key = DittoHeaderDefinition.CORRELATION_ID.getKey(); final String value = KNOWN_CORRELATION_ID; final long entrySize = key.length() + value.length(); final ImmutableDittoHeaders underTest = ImmutableDittoHeaders.of(Maps.newHashMap(key, value)); final long comparisonSize = entrySize - 1; assertThat(underTest.isEntriesSizeGreaterThan(comparisonSize)).isTrue(); }
Example #21
Source File: GatewayHttpConfigTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void tryToGetInstanceWithUnknownSchemaVersions() { final int unknownVersionNumber = -1; final Collection<Integer> knownSchemaVersions = List.of(JsonSchemaVersion.V_1.toInt(), JsonSchemaVersion.V_2.toInt()); final Collection<Integer> allSchemaVersions = new ArrayList<>(knownSchemaVersions); allSchemaVersions.add(unknownVersionNumber); final String configPath = "http." + HttpConfig.GatewayHttpConfigValue.SCHEMA_VERSIONS.getConfigPath(); final Config config = ConfigFactory.parseMap(Maps.newHashMap(configPath, allSchemaVersions)); assertThatExceptionOfType(DittoConfigError.class) .isThrownBy(() -> GatewayHttpConfig.of(config)) .withMessage("Schema version <%s> is not supported!", unknownVersionNumber) .withNoCause(); }
Example #22
Source File: GatewayHttpConfigTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void tryToGetInstanceWithUnknownQueryParametersAsHeaders() { final List<String> unknownHeaderKeys = Lists.newArrayList("foo", "bar"); final List<String> knownHeaderKeys = Lists.newArrayList(DittoHeaderDefinition.CORRELATION_ID.getKey(), DittoHeaderDefinition.RESPONSE_REQUIRED.getKey()); final List<String> allHeaderKeys = new ArrayList<>(knownHeaderKeys); allHeaderKeys.addAll(unknownHeaderKeys); final String configPath = "http." + HttpConfig.GatewayHttpConfigValue.QUERY_PARAMS_AS_HEADERS.getConfigPath(); final Config config = ConfigFactory.parseMap(Maps.newHashMap(configPath, allHeaderKeys)); assertThatExceptionOfType(DittoConfigError.class) .isThrownBy(() -> GatewayHttpConfig.of(config)) .withMessage("The query parameter names <%s> do not denote known header keys!", unknownHeaderKeys) .withNoCause(); }
Example #23
Source File: GatewayControllerEndpointTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void testRouteReturnsMetadata() { testClient.get() .uri("http://localhost:" + port + "/actuator/gateway/routes/route_with_metadata") .exchange().expectStatus().isOk().expectBody().jsonPath("$.metadata") .value(map -> assertThat((Map<String, Object>) map).hasSize(3) .containsEntry("optionName", "OptionValue") .containsEntry("iAmNumber", 1).containsEntry("compositeObject", Maps.newHashMap("name", "value"))); }
Example #24
Source File: DefaultRequestProcessorTest.java From rocketmq with Apache License 2.0 | 5 votes |
@Test public void testProcessRequest_RegisterBrokerWithFilterServer() throws RemotingCommandException, NoSuchFieldException, IllegalAccessException { RemotingCommand request = genSampleRegisterCmd(true); // version >= MQVersion.Version.V3_0_11.ordinal() to register with filter server request.setVersion(100); ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); when(ctx.channel()).thenReturn(null); RemotingCommand response = defaultRequestProcessor.processRequest(ctx, request); assertThat(response.getCode()).isEqualTo(ResponseCode.SUCCESS); assertThat(response.getRemark()).isNull(); RouteInfoManager routes = namesrvController.getRouteInfoManager(); Field brokerAddrTable = RouteInfoManager.class.getDeclaredField("brokerAddrTable"); brokerAddrTable.setAccessible(true); BrokerData broker = new BrokerData(); broker.setBrokerName("broker"); broker.setBrokerAddrs((HashMap) Maps.newHashMap(new Long(2333), "10.10.1.1")); assertThat((Map) brokerAddrTable.get(routes)) .contains(new HashMap.SimpleEntry("broker", broker)); }
Example #25
Source File: RouteDefinitionTest.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void setRouteDefinitionReplacesExistingMetadata() { Map<String, Object> originalMetadata = Maps.newHashMap("key", "value"); Map<String, Object> newMetadata = Maps.newHashMap("key2", "value2"); RouteDefinition routeDefinition = new RouteDefinition(); routeDefinition.setMetadata(originalMetadata); routeDefinition.setMetadata(newMetadata); assertThat(routeDefinition.getMetadata()).isEqualTo(newMetadata); }
Example #26
Source File: RouteDefinitionTest.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void addSingleMetadataEntryKeepsOriginalMetadata() { Map<String, Object> originalMetadata = Maps.newHashMap("key", "value"); RouteDefinition routeDefinition = new RouteDefinition(); routeDefinition.setMetadata(originalMetadata); routeDefinition.getMetadata().put("key2", "value2"); assertThat(routeDefinition.getMetadata()).hasSize(2) .containsAllEntriesOf(originalMetadata).containsEntry("key2", "value2"); }
Example #27
Source File: CheckExternalFilterTest.java From ditto with Eclipse Public License 2.0 | 5 votes |
@Test public void filterValueThatShouldNotBeReadFromExternal() { final DittoHeaderDefinition headerDefinition = DittoHeaderDefinition.DRY_RUN; final Map<String, HeaderDefinition> headerDefinitions = Maps.newHashMap(headerDefinition.getKey(), headerDefinition); final CheckExternalFilter underTest = CheckExternalFilter.shouldReadFromExternal(headerDefinitions); assertThat(underTest.apply(headerDefinition.getKey(), "true")).isNull(); }
Example #28
Source File: RouteTests.java From spring-cloud-gateway with Apache License 2.0 | 5 votes |
@Test public void isAbleToAddMetadata() { Route route = Route.async().id("1").predicate(exchange -> true) .uri("http://acme.com:8080").metadata(Maps.newHashMap("key", "value")) .metadata("key2", "value2").build(); assertThat(route.getMetadata()).hasSize(2).containsEntry("key", "value") .containsEntry("key2", "value2"); }
Example #29
Source File: DecisionServiceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test @DmnDeployment(resources = "org/flowable/dmn/engine/test/runtime/decisionServiceMultipleOutputDecisions2.dmn") public void executeDecisionServiceMultipleOutputDecisionsWithMultiOutcomes() { DmnEngine dmnEngine = flowableDmnRule.getDmnEngine(); DmnDecisionService dmnRuleService = dmnEngine.getDmnDecisionService(); Map<String, List<Map<String, Object>>> result = dmnRuleService.createExecuteDecisionBuilder() .decisionKey("expandedDecisionService") .variable("input1", "test1") .variable("input2", "test2") .variable("input3", "test3") .variable("input4", "test4") .executeDecisionService(); List<Map<String, Object>> expectedResultList1 = Arrays.asList( Maps.newHashMap("output1", "NOT EMPTY 1"), Maps.newHashMap("output1", "NOT EMPTY 2"), Maps.newHashMap("output1", "NOT EMPTY 3")); List<Map<String, Object>> expectedResultList2 = Arrays.asList( Maps.newHashMap("output2", "NOT EMPTY 1"), Maps.newHashMap("output2", "NOT EMPTY 2"), Maps.newHashMap("output2", "NOT EMPTY 3")); assertThat(result) .containsEntry("decision1", expectedResultList1) .containsEntry("decision2", expectedResultList2) .hasSize(2); }
Example #30
Source File: DecisionServiceTest.java From flowable-engine with Apache License 2.0 | 5 votes |
@Test @DmnDeployment(resources = "org/flowable/dmn/engine/test/runtime/decisionServiceMultipleOutputDecisions2.dmn") public void executeDecisionServiceMultipleOutputDecisionsWithAuditTrail() { DmnEngine dmnEngine = flowableDmnRule.getDmnEngine(); DmnDecisionService dmnRuleService = dmnEngine.getDmnDecisionService(); DecisionServiceExecutionAuditContainer result = dmnRuleService.createExecuteDecisionBuilder() .decisionKey("expandedDecisionService") .variable("input1", "test1") .variable("input2", "test2") .variable("input3", "test3") .variable("input4", "test4") .executeDecisionServiceWithAuditTrail(); List<Map<String, Object>> expectedResultList1 = Arrays.asList( Maps.newHashMap("output1", "NOT EMPTY 1"), Maps.newHashMap("output1", "NOT EMPTY 2"), Maps.newHashMap("output1", "NOT EMPTY 3")); List<Map<String, Object>> expectedResultList2 = Arrays.asList( Maps.newHashMap("output2", "NOT EMPTY 1"), Maps.newHashMap("output2", "NOT EMPTY 2"), Maps.newHashMap("output2", "NOT EMPTY 3")); assertThat(result.getDecisionServiceResult()) .containsEntry("decision1", expectedResultList1) .containsEntry("decision2", expectedResultList2) .hasSize(2); }