/**
 * 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 camelinaction.bindy;

import java.math.BigDecimal;

import junit.framework.TestCase;
import org.apache.camel.CamelContext;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.model.dataformat.BindyType;
import org.junit.Test;

/**
 * @version $Revision$
 */
public class PurchaseOrderBindyTest extends TestCase {

    @Test
    public void testBindy() throws Exception {
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(createRoute());
        context.start();

        MockEndpoint mock = context.getEndpoint("mock:result", MockEndpoint.class);
        mock.expectedBodiesReceived("Camel in Action,39.95,1\n");

        PurchaseOrder order = new PurchaseOrder();
        order.setAmount(1);
        order.setPrice(new BigDecimal("39.95"));
        order.setName("Camel in Action");

        ProducerTemplate template = context.createProducerTemplate();
        template.sendBody("direct:toCsv", order);

        mock.assertIsSatisfied();
    }

    public RouteBuilder createRoute() {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("direct:toCsv")
                        .marshal().bindy(BindyType.Csv, "camelinaction.bindy")
                        .to("mock:result");
            }
        };
    }

}

@@ -855,16 +855,41 @@
 Decimal;
+%0Aimport java.util.Locale;
 %0A%0Aimport
@@ -1356,32 +1356,144 @@
 ows Exception %7B%0A
+        final Locale locale = Locale.getDefault();%0A%0A        try %7B%0A            Locale.setDefault(Locale.US);%0A    
         CamelCon
@@ -1534,32 +1534,36 @@
 text();%0A        
+    
 context.addRoute
@@ -1576,24 +1576,28 @@
 teRoute());%0A
+    
         cont
@@ -1618,16 +1618,20 @@
         
+    
 MockEndp
@@ -1702,24 +1702,28 @@
 s);%0A        
+   
+ 
 mock.expecte
@@ -1777,16 +1777,20 @@
         
+    
 Purchase
@@ -1824,32 +1824,36 @@
 rder();%0A        
+ 
+   
 order.setAmount(
@@ -1856,16 +1856,20 @@
 unt(1);%0A
+    
         
@@ -1909,32 +1909,36 @@
 .95%22));%0A        
+    
 order.setName(%22C
@@ -1964,16 +1964,20 @@
         
+  
+  
 Producer
@@ -2038,16 +2038,20 @@
         
+    
 template
@@ -2089,24 +2089,28 @@
 );%0A%0A        
+ 
+   
 mock.assertI
@@ -2119,24 +2119,79 @@
 atisfied();%0A
+%09%7D finally %7B%0A            Locale.setDefault(locale);%0A%09%7D%0A
     %7D%0A%0A    p

Test failes with non english locale.