You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Leber, Thomas" <th...@omnetric.com> on 2017/06/06 09:52:27 UTC

camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

Hi all,

We are using blueprint and therefore we include camel-test-blueprint. This also includes Camel-core dependencies with type "test-jar":

https://github.com/apache/camel/blob/master/components/camel-test-blueprint/pom.xml

<dependency>	
	<groupId>org.apache.camel</groupId>
	<artifactId>camel-core</artifactId>
	<type>test-jar</type
 </dependency>

Problem is now that this contains a java service for " java.nio.file.spi.FileTypeDetector": https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test/resources/META-INF/services/java.nio.file.spi.FileTypeDetector

This one is specifying the class " org.apache.camel.component.file.MyFileTypeDetector": https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/component/file/MyFileTypeDetector.java

We are using in our code NIO to probe file contents. In our jUnit test cases Java is detecting the service and is therefore only loading " MyFileTypeDetector". 
This always returns "txt" for a file type.

We could fix this with adding an exclusion to our pom:

<dependency>
	<groupId>org.apache.camel</groupId>
	<artifactId>camel-test-blueprint</artifactId>
	<exclusions>
		<exclusion>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-core</artifactId>
			<type>test-jar</type>
		</exclusion>
	</exclusions>
</dependency>

This is maybe something that should be fixed or at least mentioned in the camel documentation for blueprint camel test.

Thomas Leber

AW: camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

Posted by "Leber, Thomas" <th...@omnetric.com>.
Ah sorry read this too late. Next time :)

-----Ursprüngliche Nachricht-----
Von: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Gesendet: Dienstag, 06. Juni 2017 20:23
An: users@camel.apache.org
Betreff: Re: camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

Hi

I found a little time and have committed a fix for this on the branches.

On Tue, Jun 6, 2017 at 12:25 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Ah that test-jar should only be used as part of testing 
> camel-test-blueprint itself. It should have scope=test like it does in 
> camel-spring etc.
>
> You are welcome to contribute a fix via a github PR
>
> On Tue, Jun 6, 2017 at 11:52 AM, Leber, Thomas 
> <th...@omnetric.com> wrote:
>> Hi all,
>>
>> We are using blueprint and therefore we include camel-test-blueprint. This also includes Camel-core dependencies with type "test-jar":
>>
>> https://github.com/apache/camel/blob/master/components/camel-test-blu
>> eprint/pom.xml
>>
>> <dependency>
>>         <groupId>org.apache.camel</groupId>
>>         <artifactId>camel-core</artifactId>
>>         <type>test-jar</type
>>  </dependency>
>>
>> Problem is now that this contains a java service for " 
>> java.nio.file.spi.FileTypeDetector": 
>> https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test
>> /resources/META-INF/services/java.nio.file.spi.FileTypeDetector
>>
>> This one is specifying the class " 
>> org.apache.camel.component.file.MyFileTypeDetector": 
>> https://github.com/apache/camel/blob/master/camel-core/src/test/java/
>> org/apache/camel/component/file/MyFileTypeDetector.java
>>
>> We are using in our code NIO to probe file contents. In our jUnit test cases Java is detecting the service and is therefore only loading " MyFileTypeDetector".
>> This always returns "txt" for a file type.
>>
>> We could fix this with adding an exclusion to our pom:
>>
>> <dependency>
>>         <groupId>org.apache.camel</groupId>
>>         <artifactId>camel-test-blueprint</artifactId>
>>         <exclusions>
>>                 <exclusion>
>>                         <groupId>org.apache.camel</groupId>
>>                         <artifactId>camel-core</artifactId>
>>                         <type>test-jar</type>
>>                 </exclusion>
>>         </exclusions>
>> </dependency>
>>
>> This is maybe something that should be fixed or at least mentioned in the camel documentation for blueprint camel test.
>>
>> Thomas Leber
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I found a little time and have committed a fix for this on the branches.

On Tue, Jun 6, 2017 at 12:25 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Ah that test-jar should only be used as part of testing
> camel-test-blueprint itself. It should have scope=test like it does in
> camel-spring etc.
>
> You are welcome to contribute a fix via a github PR
>
> On Tue, Jun 6, 2017 at 11:52 AM, Leber, Thomas
> <th...@omnetric.com> wrote:
>> Hi all,
>>
>> We are using blueprint and therefore we include camel-test-blueprint. This also includes Camel-core dependencies with type "test-jar":
>>
>> https://github.com/apache/camel/blob/master/components/camel-test-blueprint/pom.xml
>>
>> <dependency>
>>         <groupId>org.apache.camel</groupId>
>>         <artifactId>camel-core</artifactId>
>>         <type>test-jar</type
>>  </dependency>
>>
>> Problem is now that this contains a java service for " java.nio.file.spi.FileTypeDetector": https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test/resources/META-INF/services/java.nio.file.spi.FileTypeDetector
>>
>> This one is specifying the class " org.apache.camel.component.file.MyFileTypeDetector": https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/component/file/MyFileTypeDetector.java
>>
>> We are using in our code NIO to probe file contents. In our jUnit test cases Java is detecting the service and is therefore only loading " MyFileTypeDetector".
>> This always returns "txt" for a file type.
>>
>> We could fix this with adding an exclusion to our pom:
>>
>> <dependency>
>>         <groupId>org.apache.camel</groupId>
>>         <artifactId>camel-test-blueprint</artifactId>
>>         <exclusions>
>>                 <exclusion>
>>                         <groupId>org.apache.camel</groupId>
>>                         <artifactId>camel-core</artifactId>
>>                         <type>test-jar</type>
>>                 </exclusion>
>>         </exclusions>
>> </dependency>
>>
>> This is maybe something that should be fixed or at least mentioned in the camel documentation for blueprint camel test.
>>
>> Thomas Leber
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: camel-test-blueprint includes camel-test, breaks java.nio.file.Files.probeContentType(source);

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah that test-jar should only be used as part of testing
camel-test-blueprint itself. It should have scope=test like it does in
camel-spring etc.

You are welcome to contribute a fix via a github PR

On Tue, Jun 6, 2017 at 11:52 AM, Leber, Thomas
<th...@omnetric.com> wrote:
> Hi all,
>
> We are using blueprint and therefore we include camel-test-blueprint. This also includes Camel-core dependencies with type "test-jar":
>
> https://github.com/apache/camel/blob/master/components/camel-test-blueprint/pom.xml
>
> <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-core</artifactId>
>         <type>test-jar</type
>  </dependency>
>
> Problem is now that this contains a java service for " java.nio.file.spi.FileTypeDetector": https://github.com/apache/camel/blob/camel-2.17.x/camel-core/src/test/resources/META-INF/services/java.nio.file.spi.FileTypeDetector
>
> This one is specifying the class " org.apache.camel.component.file.MyFileTypeDetector": https://github.com/apache/camel/blob/master/camel-core/src/test/java/org/apache/camel/component/file/MyFileTypeDetector.java
>
> We are using in our code NIO to probe file contents. In our jUnit test cases Java is detecting the service and is therefore only loading " MyFileTypeDetector".
> This always returns "txt" for a file type.
>
> We could fix this with adding an exclusion to our pom:
>
> <dependency>
>         <groupId>org.apache.camel</groupId>
>         <artifactId>camel-test-blueprint</artifactId>
>         <exclusions>
>                 <exclusion>
>                         <groupId>org.apache.camel</groupId>
>                         <artifactId>camel-core</artifactId>
>                         <type>test-jar</type>
>                 </exclusion>
>         </exclusions>
> </dependency>
>
> This is maybe something that should be fixed or at least mentioned in the camel documentation for blueprint camel test.
>
> Thomas Leber



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2