-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>fuse-pocs</groupId> | ||
<artifactId>fuse-pocs-camel-ebcdic</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<camel.version>2.12.2</camel.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-core</artifactId> | ||
<version>${camel.version}</version> | ||
</dependency> | ||
|
||
<!-- Logging --> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.0.13</version> | ||
</dependency> | ||
|
||
<!-- Testing --> | ||
<dependency> | ||
<groupId>org.apache.camel</groupId> | ||
<artifactId>camel-test</artifactId> | ||
<version>${camel.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
55 changes: 55 additions & 0 deletions
55
fuse-pocs-camel-ebcdic/src/test/java/fuse/pocs/camel/ebcdic/EbcdicConsumerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package fuse.pocs.camel.ebcdic; | ||
|
||
import org.apache.camel.EndpointInject; | ||
import org.apache.camel.Produce; | ||
import org.apache.camel.ProducerTemplate; | ||
import org.apache.camel.builder.RouteBuilder; | ||
import org.apache.camel.component.mock.MockEndpoint; | ||
import org.apache.camel.test.junit4.CamelTestSupport; | ||
import org.junit.Test; | ||
|
||
import java.io.InputStream; | ||
|
||
|
||
public class EbcdicConsumerTest extends CamelTestSupport { | ||
|
||
// Routing fixtures | ||
|
||
@Produce(uri = "direct:test") | ||
ProducerTemplate producerTemplate; | ||
|
||
@EndpointInject(uri = "mock:test") | ||
MockEndpoint mockEndpoint; | ||
|
||
/** | ||
* Charsets supported by Oracle JVM - http://docs.oracle.com/javase/6/docs/technotes/guides/intl/encoding.doc.html | ||
*/ | ||
String ebcdicCharsetName = "Cp1047"; | ||
|
||
@Override | ||
protected RouteBuilder createRouteBuilder() throws Exception { | ||
return new RouteBuilder() { | ||
@Override | ||
public void configure() throws Exception { | ||
from("direct:test"). | ||
unmarshal().string(ebcdicCharsetName). | ||
to(mockEndpoint); | ||
} | ||
}; | ||
} | ||
|
||
@Test | ||
public void shouldDecodeEbcdic() throws Exception { | ||
// Given | ||
InputStream ebcdicMessage = getClass().getResourceAsStream("ebcdicMessage"); | ||
mockEndpoint.expectedMessageCount(1); | ||
mockEndpoint.message(0).body().contains("order-items"); | ||
|
||
// When | ||
producerTemplate.sendBody(ebcdicMessage); | ||
|
||
// Then | ||
assertMockEndpointsSatisfied(); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
fuse-pocs-camel-ebcdic/src/test/resources/fuse/pocs/camel/ebcdic/ebcdicMessage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
L�����n@@@@L������n@@@@@@@@L����n慄@Ֆ�@��@��z��z��@���@����La����n@@@@@@@@L��������@������~������nі�La��������n@@@@La������n@@@@L�����`�����n@@@@@@@@L�����`����n@@@@@@@@@@@@L�������n�La�������n@@@@@@@@@@@@L��������n�La��������n@@@@@@@@@@@@L�����n�K��La�����n@@@@@@@@La�����`����n@@@@@@@@L�����`����n@@@@@@@@@@@@L�������n�La�������n@@@@@@@@@@@@L��������n�La��������n@@@@@@@@@@@@L�����n�K��La�����n@@@@@@@@La�����`����n@@@@La�����`�����nLa�����n |