You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/09/18 10:36:36 UTC

svn commit: r816533 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ProducerTemplateProcessor.java main/java/org/apache/camel/processor/CompositeProcessor.java test/java/org/apache/camel/view/ModelFileGeneratorTest.java

Author: davsclaus
Date: Fri Sep 18 08:36:36 2009
New Revision: 816533

URL: http://svn.apache.org/viewvc?rev=816533&view=rev
Log:
MR-187: Added unit test and removed not needed classes.

Added:
    camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java   (with props)
Removed:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerTemplateProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/CompositeProcessor.java

Added: camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java?rev=816533&view=auto
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java (added)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java Fri Sep 18 08:36:36 2009
@@ -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.view;
+
+import java.io.File;
+import javax.xml.bind.JAXBContext;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class ModelFileGeneratorTest extends ContextTestSupport {
+    protected String outputDirectory = "target/site/model";
+
+    public void testGenerateModel() throws Exception {
+        deleteDirectory(outputDirectory);
+
+        ModelFileGenerator generator = new ModelFileGenerator(JAXBContext.newInstance("org.apache.camel.model"));
+        generator.marshalRoutesUsingJaxb(outputDirectory + "/route.xml", context.getRouteDefinitions());
+
+        File out = new File(outputDirectory + "/route.xml").getAbsoluteFile();
+        assertTrue("File should have been generated", out.exists());
+
+        String content = context.getTypeConverter().convertTo(String.class, out);
+        assertTrue("Should contain a route", content.contains("<route"));
+        assertTrue("Should contain a route", content.contains("</route>"));
+        assertTrue("Should contain a route", content.contains("direct:start"));
+        assertTrue("Should contain a route", content.contains("mock:result"));
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start").to("mock:result");
+            }
+        };
+    }
+}

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/view/ModelFileGeneratorTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date