Author: davsclaus
Date: Mon Feb 11 07:51:15 2013
New Revision: 1444671
URL: http://svn.apache.org/r1444671
Log:
CAMEL-5807: Added new camel-base64 data format. Thanks to Laurynas Lubys for
contribution.
Added:
camel/trunk/components/camel-base64/ (with props)
camel/trunk/components/camel-base64/pom.xml (with props)
camel/trunk/components/camel-base64/src/
camel/trunk/components/camel-base64/src/main/
camel/trunk/components/camel-base64/src/main/java/
camel/trunk/components/camel-base64/src/main/java/org/
camel/trunk/components/camel-base64/src/main/java/org/apache/
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
(with props)
camel/trunk/components/camel-base64/src/main/resources/
camel/trunk/components/camel-base64/src/main/resources/META-INF/
camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
(with props)
camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
(with props)
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/base64
camel/trunk/components/camel-base64/src/test/
camel/trunk/components/camel-base64/src/test/java/
camel/trunk/components/camel-base64/src/test/java/org/
camel/trunk/components/camel-base64/src/test/java/org/apache/
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
(with props)
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
(with props)
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
(with props)
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
(with props)
camel/trunk/components/camel-base64/src/test/resources/
camel/trunk/components/camel-base64/src/test/resources/log4j.properties
(with props)
Modified:
camel/trunk/components/pom.xml
Propchange: camel/trunk/components/camel-base64/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Feb 11 07:51:15 2013
@@ -0,0 +1,16 @@
+.pmd
+.checkstyle
+.ruleset
+target
+.settings
+.classpath
+.project
+.wtpmodules
+prj.el
+.jdee_classpath
+.jdee_sources
+velocity.log
+eclipse-classes
+*.ipr
+*.iml
+*.iws
Added: camel/trunk/components/camel-base64/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/pom.xml?rev=1444671&view=auto
==============================================================================
--- camel/trunk/components/camel-base64/pom.xml (added)
+++ camel/trunk/components/camel-base64/pom.xml Mon Feb 11 07:51:15 2013
@@ -0,0 +1,68 @@
+<?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.
+-->
+<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>
+
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>components</artifactId>
+ <version>2.11-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-base64</artifactId>
+ <packaging>bundle</packaging>
+ <name>Camel :: Base64</name>
+ <description>Camel Base64 support</description>
+
+ <properties>
+ <camel.osgi.export.pkg>
+ org.apache.camel.dataformat.base64.*
+ </camel.osgi.export.pkg>
+ <camel.osgi.export.service>
+ org.apache.camel.spi.DataFormatResolver;dataformat=base64
+ </camel.osgi.export.service>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons-codec-version}</version>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Propchange: camel/trunk/components/camel-base64/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-base64/pom.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/components/camel-base64/pom.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added:
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
(added)
+++
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,85 @@
+/**
+ * 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.dataformat.base64;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.spi.DataFormat;
+import org.apache.camel.util.ExchangeHelper;
+import org.apache.camel.util.IOHelper;
+import org.apache.commons.codec.binary.Base64;
+
+public class Base64DataFormat implements DataFormat {
+
+ private int lineLength = Base64.MIME_CHUNK_SIZE;
+ private byte[] lineSeparator = {'\r', '\n'};
+ private boolean urlSafe;
+
+ @Override
+ public void marshal(Exchange exchange, Object graph, OutputStream stream)
throws Exception {
+ byte[] decoded = ExchangeHelper.convertToMandatoryType(exchange,
byte[].class, graph);
+
+ Base64 codec = createCodec();
+ byte[] encoded = codec.encode(decoded);
+
+ stream.write(encoded);
+ }
+
+ @Override
+ public Object unmarshal(Exchange exchange, InputStream input) throws
Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ IOHelper.copyAndCloseInput(input, baos);
+ byte[] encoded = baos.toByteArray();
+ baos.close();
+
+ Base64 codec = createCodec();
+ byte[] decoded = codec.decode(encoded);
+
+ return decoded;
+ }
+
+ private Base64 createCodec() {
+ return new Base64(lineLength, lineSeparator, urlSafe);
+ }
+
+ public int getLineLength() {
+ return lineLength;
+ }
+
+ public void setLineLength(int lineLength) {
+ this.lineLength = lineLength;
+ }
+
+ public byte[] getLineSeparator() {
+ return lineSeparator;
+ }
+
+ public void setLineSeparator(byte[] lineSeparator) {
+ this.lineSeparator = lineSeparator;
+ }
+
+ public boolean isUrlSafe() {
+ return urlSafe;
+ }
+
+ public void setUrlSafe(boolean urlSafe) {
+ this.urlSafe = urlSafe;
+ }
+}
Propchange:
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/main/java/org/apache/camel/dataformat/base64/Base64DataFormat.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt?rev=1444671&view=auto
==============================================================================
--- camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
(added)
+++ camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
Propchange:
camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:executable = *
Propchange:
camel/trunk/components/camel-base64/src/main/resources/META-INF/LICENSE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt?rev=1444671&view=auto
==============================================================================
--- camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
(added)
+++ camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
Propchange:
camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/main/resources/META-INF/NOTICE.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/base64
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/base64?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/base64
(added)
+++
camel/trunk/components/camel-base64/src/main/resources/META-INF/services/org/apache/camel/dataformat/base64
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,18 @@
+#
+# 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.
+#
+
+class=org.apache.camel.dataformat.base64.Base64DataFormat
Added:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
(added)
+++
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,56 @@
+/**
+ * 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.dataformat.base64;
+
+import org.junit.Test;
+
+public class Base64DataFormatDefaultsTest extends Base64DataFormatTestBase {
+
+ private static final String ENCODED =
"IrRWhNZNjFxQ6WXJEIsehbnFdurtgacAq+t6Zh3uYlyclF3HAx995mbIydQlymM8V3yA+Yb1p3Ij\r\n"
+ +
"7AS1VQaUNHAljNpHUqrWR6EmASZV/EQvR5Gk8XDvRrrtkoDm+jdZ/XKfest2OIzhixZF1mcqyi1P\r\n"
+ +
"Hep/rFnVPclO9WOWtCCRhz+U2soBzNBtvTc6x1pz1gOZcoOEFKHSf2kmkq1/7hHFl5Cb9nbSBgyp\r\n"
+ +
"lFzsInVBfCkRxXAFixwbC3B+LB8e15zSMvoG6okyDs7C8QShIZCXGHlsuUiH96izUbfB8qpTQK80\r\n"
+ +
"PPAisxYhF/gb678wvO5e/03AmFmYbBqzwoNQ6PoZKFI8a4PUrLoCLrUnKQgwOXueb1y8d4bsVGrX\r\n"
+ +
"H5QUFgAE3yZEn2ZQtVv6bZnm3lvBe/LLRD4xIU2Pcm5e+DJUZhHcl/8MaioDWFgYPLftDKvEUwLB\r\n"
+ +
"3IFWLSKMKFoeXn2nkwxsCHrzhajhbkKl1+H9I7Gkd19DyAoPIriWOJScog+mcP0iqG9iMqYFko2n\r\n"
+ +
"rh2rr+jcyKFBhrRUuNw3W8+h+FOwZDLcBmuTv2lEOvUdaPgD+1e6fXpuxhiih4wf/zlakeVa031T\r\n"
+ +
"9c0/HN02z0cAhLT1vtEA0zDn6OzzhY//Mh332ZmC+xro+e9o2a6+dnwamDtLuRgDDd+EcoUQpfEL\r\n"
+ +
"XobX3ZSX7OQw1ZXxWiJLtSOc5yLRkdbxdLK/C6fkcY4cqc/RwBGYtXN7Z1ENG/s/LnrZnRU/ErMW\r\n"
+ +
"RtbRwehA/0a2KSbNOMwK8BpzDruXufLXZcGaDKRUektQfdX4XhhYESt1drewlQLVaEWrZBR8JOd5\r\n"
+ +
"mckulPhwHp2Q00YyoScEj6Rs/9siyv49/FSaRCbnfzl3CRnNvCOD1cvF4OneYbVJCMOY49ucFmN/\r\n"
+ +
"mBCyxLOtJ4Zz8EG1FC81QTg3Scw+FdFDsCgr7DqVrmPOLikqq6wJdLBjyHXuMiVP9Fq/aAxvXEgj\r\n"
+ +
"RuVnN20wn2tUOXeaN4XqziQ66M229HsY0BX5riJ00yXArDxd+I9mFDpw/UDnGBAE2P//1fU1ns1A\r\n"
+ +
"6zQ6hTv7axdlw3/FnOAdymEKqED9CPfbiDvJygcAcxv2fyORHQ+TiprMGxckAlnLZ2pGl+gOzbtZ\r\n"
+ +
"zJgecyFJHBbhtkubGD4zzQhuJJw8ypqppSxqDs8SAW2frj42UT9qRMeCBGXLa1wyISt4GI6iOnfw\r\n"
+ +
"TCRJ/SE7CVrEfmdmROlJpAJHfUlQIJq1aW3mTE5zTmAygypxRUDCmA+eY9wdCicFp6YptdCEK3P2\r\n"
+ + "7QzZsSASAByd5jxHMiIBkdwGzj1501xZ7hFLJDXDTQ==\r\n";
+
+ public Base64DataFormatDefaultsTest() {
+ format = new Base64DataFormat();
+ }
+
+ @Test
+ public void testEncode() throws Exception {
+ runEncoderTest(DECODED, ENCODED.getBytes());
+ }
+
+ @Test
+ public void testDecode() throws Exception {
+ runDecoderTest(ENCODED.getBytes(), DECODED);
+ }
+
+}
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatDefaultsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
(added)
+++
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,57 @@
+/**
+ * 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.dataformat.base64;
+
+import org.junit.Test;
+
+public class Base64DataFormatLineEndingsTest extends Base64DataFormatTestBase {
+
+ private static final String ENCODED =
"IrRWhNZNjFxQ6WXJEIsehbnFdurtgacAq+t6Zh3uYlyclF3HAx995mbIydQlymM8V3yA+Yb1p3Ij\n"
+ +
"7AS1VQaUNHAljNpHUqrWR6EmASZV/EQvR5Gk8XDvRrrtkoDm+jdZ/XKfest2OIzhixZF1mcqyi1P\n"
+ +
"Hep/rFnVPclO9WOWtCCRhz+U2soBzNBtvTc6x1pz1gOZcoOEFKHSf2kmkq1/7hHFl5Cb9nbSBgyp\n"
+ +
"lFzsInVBfCkRxXAFixwbC3B+LB8e15zSMvoG6okyDs7C8QShIZCXGHlsuUiH96izUbfB8qpTQK80\n"
+ +
"PPAisxYhF/gb678wvO5e/03AmFmYbBqzwoNQ6PoZKFI8a4PUrLoCLrUnKQgwOXueb1y8d4bsVGrX\n"
+ +
"H5QUFgAE3yZEn2ZQtVv6bZnm3lvBe/LLRD4xIU2Pcm5e+DJUZhHcl/8MaioDWFgYPLftDKvEUwLB\n"
+ +
"3IFWLSKMKFoeXn2nkwxsCHrzhajhbkKl1+H9I7Gkd19DyAoPIriWOJScog+mcP0iqG9iMqYFko2n\n"
+ +
"rh2rr+jcyKFBhrRUuNw3W8+h+FOwZDLcBmuTv2lEOvUdaPgD+1e6fXpuxhiih4wf/zlakeVa031T\n"
+ +
"9c0/HN02z0cAhLT1vtEA0zDn6OzzhY//Mh332ZmC+xro+e9o2a6+dnwamDtLuRgDDd+EcoUQpfEL\n"
+ +
"XobX3ZSX7OQw1ZXxWiJLtSOc5yLRkdbxdLK/C6fkcY4cqc/RwBGYtXN7Z1ENG/s/LnrZnRU/ErMW\n"
+ +
"RtbRwehA/0a2KSbNOMwK8BpzDruXufLXZcGaDKRUektQfdX4XhhYESt1drewlQLVaEWrZBR8JOd5\n"
+ +
"mckulPhwHp2Q00YyoScEj6Rs/9siyv49/FSaRCbnfzl3CRnNvCOD1cvF4OneYbVJCMOY49ucFmN/\n"
+ +
"mBCyxLOtJ4Zz8EG1FC81QTg3Scw+FdFDsCgr7DqVrmPOLikqq6wJdLBjyHXuMiVP9Fq/aAxvXEgj\n"
+ +
"RuVnN20wn2tUOXeaN4XqziQ66M229HsY0BX5riJ00yXArDxd+I9mFDpw/UDnGBAE2P//1fU1ns1A\n"
+ +
"6zQ6hTv7axdlw3/FnOAdymEKqED9CPfbiDvJygcAcxv2fyORHQ+TiprMGxckAlnLZ2pGl+gOzbtZ\n"
+ +
"zJgecyFJHBbhtkubGD4zzQhuJJw8ypqppSxqDs8SAW2frj42UT9qRMeCBGXLa1wyISt4GI6iOnfw\n"
+ +
"TCRJ/SE7CVrEfmdmROlJpAJHfUlQIJq1aW3mTE5zTmAygypxRUDCmA+eY9wdCicFp6YptdCEK3P2\n"
+ + "7QzZsSASAByd5jxHMiIBkdwGzj1501xZ7hFLJDXDTQ==\n";
+
+ public Base64DataFormatLineEndingsTest() {
+ format = new Base64DataFormat();
+ byte[] separator = {'\n'};
+ format.setLineSeparator(separator);
+ }
+
+ @Test
+ public void testEncode() throws Exception {
+ runEncoderTest(DECODED, ENCODED.getBytes());
+ }
+
+ @Test
+ public void testDecode() throws Exception {
+ runDecoderTest(ENCODED.getBytes(), DECODED);
+ }
+}
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineEndingsTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
(added)
+++
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,60 @@
+/**
+ * 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.dataformat.base64;
+
+import org.junit.Test;
+
+public class Base64DataFormatLineLengthTest extends Base64DataFormatTestBase {
+
+ private static final String ENCODED =
"IrRWhNZNjFxQ6WXJEIsehbnFdurtgacAq+t6Zh3uYlyclF3HAx995mbIydQlymM8\r\n"
+ +
"V3yA+Yb1p3Ij7AS1VQaUNHAljNpHUqrWR6EmASZV/EQvR5Gk8XDvRrrtkoDm+jdZ\r\n"
+ +
"/XKfest2OIzhixZF1mcqyi1PHep/rFnVPclO9WOWtCCRhz+U2soBzNBtvTc6x1pz\r\n"
+ +
"1gOZcoOEFKHSf2kmkq1/7hHFl5Cb9nbSBgyplFzsInVBfCkRxXAFixwbC3B+LB8e\r\n"
+ +
"15zSMvoG6okyDs7C8QShIZCXGHlsuUiH96izUbfB8qpTQK80PPAisxYhF/gb678w\r\n"
+ +
"vO5e/03AmFmYbBqzwoNQ6PoZKFI8a4PUrLoCLrUnKQgwOXueb1y8d4bsVGrXH5QU\r\n"
+ +
"FgAE3yZEn2ZQtVv6bZnm3lvBe/LLRD4xIU2Pcm5e+DJUZhHcl/8MaioDWFgYPLft\r\n"
+ +
"DKvEUwLB3IFWLSKMKFoeXn2nkwxsCHrzhajhbkKl1+H9I7Gkd19DyAoPIriWOJSc\r\n"
+ +
"og+mcP0iqG9iMqYFko2nrh2rr+jcyKFBhrRUuNw3W8+h+FOwZDLcBmuTv2lEOvUd\r\n"
+ +
"aPgD+1e6fXpuxhiih4wf/zlakeVa031T9c0/HN02z0cAhLT1vtEA0zDn6OzzhY//\r\n"
+ +
"Mh332ZmC+xro+e9o2a6+dnwamDtLuRgDDd+EcoUQpfELXobX3ZSX7OQw1ZXxWiJL\r\n"
+ +
"tSOc5yLRkdbxdLK/C6fkcY4cqc/RwBGYtXN7Z1ENG/s/LnrZnRU/ErMWRtbRwehA\r\n"
+ +
"/0a2KSbNOMwK8BpzDruXufLXZcGaDKRUektQfdX4XhhYESt1drewlQLVaEWrZBR8\r\n"
+ +
"JOd5mckulPhwHp2Q00YyoScEj6Rs/9siyv49/FSaRCbnfzl3CRnNvCOD1cvF4One\r\n"
+ +
"YbVJCMOY49ucFmN/mBCyxLOtJ4Zz8EG1FC81QTg3Scw+FdFDsCgr7DqVrmPOLikq\r\n"
+ +
"q6wJdLBjyHXuMiVP9Fq/aAxvXEgjRuVnN20wn2tUOXeaN4XqziQ66M229HsY0BX5\r\n"
+ +
"riJ00yXArDxd+I9mFDpw/UDnGBAE2P//1fU1ns1A6zQ6hTv7axdlw3/FnOAdymEK\r\n"
+ +
"qED9CPfbiDvJygcAcxv2fyORHQ+TiprMGxckAlnLZ2pGl+gOzbtZzJgecyFJHBbh\r\n"
+ +
"tkubGD4zzQhuJJw8ypqppSxqDs8SAW2frj42UT9qRMeCBGXLa1wyISt4GI6iOnfw\r\n"
+ +
"TCRJ/SE7CVrEfmdmROlJpAJHfUlQIJq1aW3mTE5zTmAygypxRUDCmA+eY9wdCicF\r\n"
+ + "p6YptdCEK3P27QzZsSASAByd5jxHMiIBkdwGzj1501xZ7hFLJDXDTQ==\r\n";
+
+ public Base64DataFormatLineLengthTest() {
+ format = new Base64DataFormat();
+ format.setLineLength(64);
+ }
+
+ @Test
+ public void testEncode() throws Exception {
+ runEncoderTest(DECODED, ENCODED.getBytes());
+ }
+
+ @Test
+ public void testDecode() throws Exception {
+ runDecoderTest(ENCODED.getBytes(), DECODED);
+ }
+
+}
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatLineLengthTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java?rev=1444671&view=auto
==============================================================================
---
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
(added)
+++
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
Mon Feb 11 07:51:15 2013
@@ -0,0 +1,138 @@
+/**
+ * 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.dataformat.base64;
+
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+
+public abstract class Base64DataFormatTestBase extends CamelTestSupport {
+
+ static final byte[] DECODED = {34, -76, 86, -124, -42, 77, -116, 92, 80,
+ -23, 101, -55, 16, -117, 30, -123, -71, -59, 118, -22, -19, -127,
+ -89, 0, -85, -21, 122, 102, 29, -18, 98, 92, -100, -108, 93, -57,
+ 3, 31, 125, -26, 102, -56, -55, -44, 37, -54, 99, 60, 87, 124,
+ -128, -7, -122, -11, -89, 114, 35, -20, 4, -75, 85, 6, -108, 52,
+ 112, 37, -116, -38, 71, 82, -86, -42, 71, -95, 38, 1, 38, 85, -4,
+ 68, 47, 71, -111, -92, -15, 112, -17, 70, -70, -19, -110, -128,
+ -26, -6, 55, 89, -3, 114, -97, 122, -53, 118, 56, -116, -31, -117,
+ 22, 69, -42, 103, 42, -54, 45, 79, 29, -22, 127, -84, 89, -43, 61,
+ -55, 78, -11, 99, -106, -76, 32, -111, -121, 63, -108, -38, -54, 1,
+ -52, -48, 109, -67, 55, 58, -57, 90, 115, -42, 3, -103, 114, -125,
+ -124, 20, -95, -46, 127, 105, 38, -110, -83, 127, -18, 17, -59,
+ -105, -112, -101, -10, 118, -46, 6, 12, -87, -108, 92, -20, 34,
+ 117, 65, 124, 41, 17, -59, 112, 5, -117, 28, 27, 11, 112, 126, 44,
+ 31, 30, -41, -100, -46, 50, -6, 6, -22, -119, 50, 14, -50, -62,
+ -15, 4, -95, 33, -112, -105, 24, 121, 108, -71, 72, -121, -9, -88,
+ -77, 81, -73, -63, -14, -86, 83, 64, -81, 52, 60, -16, 34, -77, 22,
+ 33, 23, -8, 27, -21, -65, 48, -68, -18, 94, -1, 77, -64, -104, 89,
+ -104, 108, 26, -77, -62, -125, 80, -24, -6, 25, 40, 82, 60, 107,
+ -125, -44, -84, -70, 2, 46, -75, 39, 41, 8, 48, 57, 123, -98, 111,
+ 92, -68, 119, -122, -20, 84, 106, -41, 31, -108, 20, 22, 0, 4, -33,
+ 38, 68, -97, 102, 80, -75, 91, -6, 109, -103, -26, -34, 91, -63,
+ 123, -14, -53, 68, 62, 49, 33, 77, -113, 114, 110, 94, -8, 50, 84,
+ 102, 17, -36, -105, -1, 12, 106, 42, 3, 88, 88, 24, 60, -73, -19,
+ 12, -85, -60, 83, 2, -63, -36, -127, 86, 45, 34, -116, 40, 90, 30,
+ 94, 125, -89, -109, 12, 108, 8, 122, -13, -123, -88, -31, 110, 66,
+ -91, -41, -31, -3, 35, -79, -92, 119, 95, 67, -56, 10, 15, 34, -72,
+ -106, 56, -108, -100, -94, 15, -90, 112, -3, 34, -88, 111, 98, 50,
+ -90, 5, -110, -115, -89, -82, 29, -85, -81, -24, -36, -56, -95, 65,
+ -122, -76, 84, -72, -36, 55, 91, -49, -95, -8, 83, -80, 100, 50,
+ -36, 6, 107, -109, -65, 105, 68, 58, -11, 29, 104, -8, 3, -5, 87,
+ -70, 125, 122, 110, -58, 24, -94, -121, -116, 31, -1, 57, 90, -111,
+ -27, 90, -45, 125, 83, -11, -51, 63, 28, -35, 54, -49, 71, 0, -124,
+ -76, -11, -66, -47, 0, -45, 48, -25, -24, -20, -13, -123, -113, -1,
+ 50, 29, -9, -39, -103, -126, -5, 26, -24, -7, -17, 104, -39, -82,
+ -66, 118, 124, 26, -104, 59, 75, -71, 24, 3, 13, -33, -124, 114,
+ -123, 16, -91, -15, 11, 94, -122, -41, -35, -108, -105, -20, -28,
+ 48, -43, -107, -15, 90, 34, 75, -75, 35, -100, -25, 34, -47, -111,
+ -42, -15, 116, -78, -65, 11, -89, -28, 113, -114, 28, -87, -49,
+ -47, -64, 17, -104, -75, 115, 123, 103, 81, 13, 27, -5, 63, 46,
+ 122, -39, -99, 21, 63, 18, -77, 22, 70, -42, -47, -63, -24, 64, -1,
+ 70, -74, 41, 38, -51, 56, -52, 10, -16, 26, 115, 14, -69, -105,
+ -71, -14, -41, 101, -63, -102, 12, -92, 84, 122, 75, 80, 125, -43,
+ -8, 94, 24, 88, 17, 43, 117, 118, -73, -80, -107, 2, -43, 104, 69,
+ -85, 100, 20, 124, 36, -25, 121, -103, -55, 46, -108, -8, 112, 30,
+ -99, -112, -45, 70, 50, -95, 39, 4, -113, -92, 108, -1, -37, 34,
+ -54, -2, 61, -4, 84, -102, 68, 38, -25, 127, 57, 119, 9, 25, -51,
+ -68, 35, -125, -43, -53, -59, -32, -23, -34, 97, -75, 73, 8, -61,
+ -104, -29, -37, -100, 22, 99, 127, -104, 16, -78, -60, -77, -83,
+ 39, -122, 115, -16, 65, -75, 20, 47, 53, 65, 56, 55, 73, -52, 62,
+ 21, -47, 67, -80, 40, 43, -20, 58, -107, -82, 99, -50, 46, 41, 42,
+ -85, -84, 9, 116, -80, 99, -56, 117, -18, 50, 37, 79, -12, 90, -65,
+ 104, 12, 111, 92, 72, 35, 70, -27, 103, 55, 109, 48, -97, 107, 84,
+ 57, 119, -102, 55, -123, -22, -50, 36, 58, -24, -51, -74, -12, 123,
+ 24, -48, 21, -7, -82, 34, 116, -45, 37, -64, -84, 60, 93, -8, -113,
+ 102, 20, 58, 112, -3, 64, -25, 24, 16, 4, -40, -1, -1, -43, -11,
+ 53, -98, -51, 64, -21, 52, 58, -123, 59, -5, 107, 23, 101, -61,
+ 127, -59, -100, -32, 29, -54, 97, 10, -88, 64, -3, 8, -9, -37,
+ -120, 59, -55, -54, 7, 0, 115, 27, -10, 127, 35, -111, 29, 15,
+ -109, -118, -102, -52, 27, 23, 36, 2, 89, -53, 103, 106, 70, -105,
+ -24, 14, -51, -69, 89, -52, -104, 30, 115, 33, 73, 28, 22, -31,
+ -74, 75, -101, 24, 62, 51, -51, 8, 110, 36, -100, 60, -54, -102,
+ -87, -91, 44, 106, 14, -49, 18, 1, 109, -97, -82, 62, 54, 81, 63,
+ 106, 68, -57, -126, 4, 101, -53, 107, 92, 50, 33, 43, 120, 24,
+ -114, -94, 58, 119, -16, 76, 36, 73, -3, 33, 59, 9, 90, -60, 126,
+ 103, 102, 68, -23, 73, -92, 2, 71, 125, 73, 80, 32, -102, -75, 105,
+ 109, -26, 76, 78, 115, 78, 96, 50, -125, 42, 113, 69, 64, -62,
+ -104, 15, -98, 99, -36, 29, 10, 39, 5, -89, -90, 41, -75, -48,
+ -124, 43, 115, -10, -19, 12, -39, -79, 32, 18, 0, 28, -99, -26, 60,
+ 71, 50, 34, 1, -111, -36, 6, -50, 61, 121, -45, 92, 89, -18, 17,
+ 75, 36, 53, -61, 77};
+
+ protected Base64DataFormat format = new Base64DataFormat();
+
+ @EndpointInject(uri = "mock:result")
+ private MockEndpoint result;
+
+ protected void runEncoderTest(byte[] raw, byte[] expected) throws
Exception {
+ result.setExpectedMessageCount(1);
+
+ template.sendBody("direct:startEncode", raw);
+
+ assertMockEndpointsSatisfied();
+
+ byte[] encoded =
result.getReceivedExchanges().get(0).getIn().getBody(byte[].class);
+ assertArrayEquals(expected, encoded);
+ }
+
+ protected void runDecoderTest(byte[] encoded, byte[] expected) throws
Exception {
+ result.setExpectedMessageCount(1);
+
+ template.sendBody("direct:startDecode", encoded);
+
+ assertMockEndpointsSatisfied();
+
+ byte[] decoded =
result.getReceivedExchanges().get(0).getIn().getBody(byte[].class);
+ assertArrayEquals(expected, decoded);
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+
+ @Override
+ public void configure() throws Exception {
+ from("direct:startEncode").marshal(format).to("mock:result");
+
+ from("direct:startDecode").unmarshal(format).to("mock:result");
+ }
+ };
+ }
+
+}
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/test/java/org/apache/camel/dataformat/base64/Base64DataFormatTestBase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/components/camel-base64/src/test/resources/log4j.properties
URL:
http://svn.apache.org/viewvc/camel/trunk/components/camel-base64/src/test/resources/log4j.properties?rev=1444671&view=auto
==============================================================================
--- camel/trunk/components/camel-base64/src/test/resources/log4j.properties
(added)
+++ camel/trunk/components/camel-base64/src/test/resources/log4j.properties Mon
Feb 11 07:51:15 2013
@@ -0,0 +1,32 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=info, file
+
+# CONSOLE appender not used by default
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+
+# File appender
+log4j.appender.file=org.apache.log4j.FileAppender
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
+log4j.appender.file.layout.ConversionPattern=%d %-5p %c{1} - %m %n
+log4j.appender.file.file=target/camel-base64-test.log
Propchange:
camel/trunk/components/camel-base64/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
camel/trunk/components/camel-base64/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:executable = *
Propchange:
camel/trunk/components/camel-base64/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
camel/trunk/components/camel-base64/src/test/resources/log4j.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: camel/trunk/components/pom.xml
URL:
http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1444671&r1=1444670&r2=1444671&view=diff
==============================================================================
--- camel/trunk/components/pom.xml (original)
+++ camel/trunk/components/pom.xml Mon Feb 11 07:51:15 2013
@@ -61,6 +61,7 @@
<module>camel-atom</module>
<module>camel-avro</module>
<module>camel-aws</module>
+ <module>camel-base64</module>
<module>camel-beanio</module>
<module>camel-bean-validator</module>
<module>camel-bindy</module>