This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new b9f3208a0ee Remove flaky test b9f3208a0ee is described below commit b9f3208a0eed049d49fb86e8a90fc9d03f3957b8 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue May 14 12:38:51 2024 +0200 Remove flaky test --- .../camel/spring/file/SpringFileRouteTest.java | 78 ---------------------- .../spring/file/SpringFileRouteTest-context.xml | 43 ------------ 2 files changed, 121 deletions(-) diff --git a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java b/components/camel-spring-xml/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java deleted file mode 100644 index 003c17d26b9..00000000000 --- a/components/camel-spring-xml/src/test/java/org/apache/camel/spring/file/SpringFileRouteTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.spring.file; - -import java.nio.file.Path; - -import org.apache.camel.Endpoint; -import org.apache.camel.EndpointInject; -import org.apache.camel.Exchange; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.component.file.FileEndpoint; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.spring.SpringRunWithTestSupport; -import org.apache.camel.spring.file.SpringFileRouteTest.TestDirectoryContextInitializer; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContextInitializer; -import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.test.context.ContextConfiguration; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -@ContextConfiguration(initializers = TestDirectoryContextInitializer.class) -public class SpringFileRouteTest extends SpringRunWithTestSupport { - protected String expectedBody = "Hello World!"; - @Autowired - protected ProducerTemplate template; - @Autowired - protected Endpoint inputFile; - @EndpointInject("mock:result") - protected MockEndpoint result; - @TempDir - private static Path tempDir; - - @Test - public void testMocksAreValid() throws Exception { - // lets check that our injected endpoint is valid - FileEndpoint fileEndpoint = assertIsInstanceOf(FileEndpoint.class, inputFile); - assertEquals(testDirectory().toFile(), fileEndpoint.getFile(), "File"); - - result.expectedBodiesReceived(expectedBody); - result.setResultWaitTime(5000); - - template.sendBodyAndHeader(inputFile, expectedBody, Exchange.FILE_NAME, "hello.txt"); - - result.assertIsSatisfied(); - } - - @Override - public Path testDirectory() { - return tempDir; - } - - static class TestDirectoryContextInitializer - implements - ApplicationContextInitializer<ConfigurableApplicationContext> { - @Override - public void initialize(ConfigurableApplicationContext context) { - context.getEnvironment().getSystemProperties().put("testDirectory", tempDir.toString()); - } - } - -} diff --git a/components/camel-spring-xml/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml b/components/camel-spring-xml/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml deleted file mode 100644 index 3a494b7112a..00000000000 --- a/components/camel-spring-xml/src/test/resources/org/apache/camel/spring/file/SpringFileRouteTest-context.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd - "> - - <!-- START SNIPPET: example --> - <camelContext xmlns="http://camel.apache.org/schema/spring"> - <jmxAgent id="jmx" disabled="true"/> - <template id="camelTemplate"/> - - <route> - <from uri="ref:inputFile"/> - <to uri="mock:result"/> - </route> - </camelContext> - - <bean id="inputFile" class="org.apache.camel.component.file.FileEndpoint"> - <property name="file" value="#{systemProperties['testDirectory']}"/> - </bean> - <!-- END SNIPPET: example --> - -</beans>