Rest DSL. camel-swagger work in progress.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7aa0b4a1 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7aa0b4a1 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7aa0b4a1 Branch: refs/heads/master Commit: 7aa0b4a1613eec32af23c0a230fb8937b695802f Parents: 1a6fe60 Author: Claus Ibsen <davscl...@apache.org> Authored: Sat Aug 9 09:54:16 2014 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sat Aug 9 09:54:16 2014 +0200 ---------------------------------------------------------------------- .../RestSwaggerApiDeclarationServlet.scala | 30 ++++++++++---------- .../component/swagger/RestSwaggerReader.scala | 30 ++++++++++---------- .../swagger/RestSwaggerReaderTest.java | 6 ++-- 3 files changed, 33 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/7aa0b4a1/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala ---------------------------------------------------------------------- diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala index ca7106b..0cb985f 100644 --- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala +++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerApiDeclarationServlet.scala @@ -1,17 +1,3 @@ -package org.apache.camel.component.swagger - -import com.wordnik.swagger.servlet.listing.{ApiListingCache, ApiDeclarationServlet} -import javax.servlet.http.{HttpServletResponse, HttpServletRequest} -import com.wordnik.swagger.core.filter.SpecFilter -import com.wordnik.swagger.config.{ConfigFactory, FilterFactory} -import com.wordnik.swagger.model.{ResourceListing, ApiListingReference} -import com.wordnik.swagger.core.util.JsonSerializer -import javax.servlet.ServletConfig -import org.springframework.web.context.support.WebApplicationContextUtils -import org.springframework.web.context.WebApplicationContext -import org.apache.camel.CamelContext -import org.slf4j.LoggerFactory - /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,7 +6,7 @@ import org.slf4j.LoggerFactory * (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 + * 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, @@ -28,6 +14,20 @@ import org.slf4j.LoggerFactory * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.camel.component.swagger + +import com.wordnik.swagger.servlet.listing.{ApiListingCache, ApiDeclarationServlet} +import javax.servlet.http.{HttpServletResponse, HttpServletRequest} +import com.wordnik.swagger.core.filter.SpecFilter +import com.wordnik.swagger.config.{ConfigFactory, FilterFactory} +import com.wordnik.swagger.model.{ResourceListing, ApiListingReference} +import com.wordnik.swagger.core.util.JsonSerializer +import javax.servlet.ServletConfig +import org.springframework.web.context.support.WebApplicationContextUtils +import org.springframework.web.context.WebApplicationContext +import org.apache.camel.CamelContext +import org.slf4j.LoggerFactory + class RestSwaggerApiDeclarationServlet extends ApiDeclarationServlet { private val LOG = LoggerFactory.getLogger(classOf[RestSwaggerApiDeclarationServlet]) http://git-wip-us.apache.org/repos/asf/camel/blob/7aa0b4a1/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala ---------------------------------------------------------------------- diff --git a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala index ff05501..c8e84a7 100644 --- a/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala +++ b/components/camel-swagger/src/main/scala/org/apache/camel/component/swagger/RestSwaggerReader.scala @@ -1,17 +1,3 @@ -package org.apache.camel.component.swagger - -import org.apache.camel.model.rest.{VerbDefinition, RestDefinition} -import com.wordnik.swagger.config.SwaggerConfig -import com.wordnik.swagger.model.{ApiDescription, Operation, ApiListing} -import org.slf4j.LoggerFactory -import com.wordnik.swagger.core.util.ModelUtil -import com.wordnik.swagger.core.SwaggerSpec -import scala.collection.mutable.ListBuffer -import java.util.Locale - -// to iterate using for loop -import scala.collection.JavaConverters._ - /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -20,7 +6,7 @@ import scala.collection.JavaConverters._ * (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 + * 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, @@ -28,6 +14,20 @@ import scala.collection.JavaConverters._ * See the License for the specific language governing permissions and * limitations under the License. */ +package org.apache.camel.component.swagger + +import org.apache.camel.model.rest.{VerbDefinition, RestDefinition} +import com.wordnik.swagger.config.SwaggerConfig +import com.wordnik.swagger.model.{ApiDescription, Operation, ApiListing} +import org.slf4j.LoggerFactory +import com.wordnik.swagger.core.util.ModelUtil +import com.wordnik.swagger.core.SwaggerSpec +import scala.collection.mutable.ListBuffer +import java.util.Locale + +// to iterate using for loop +import scala.collection.JavaConverters._ + class RestSwaggerReader { private val LOG = LoggerFactory.getLogger(classOf[RestSwaggerReader]) http://git-wip-us.apache.org/repos/asf/camel/blob/7aa0b4a1/components/camel-swagger/src/test/java/org/apache/camel/component/swagger/RestSwaggerReaderTest.java ---------------------------------------------------------------------- diff --git a/components/camel-swagger/src/test/java/org/apache/camel/component/swagger/RestSwaggerReaderTest.java b/components/camel-swagger/src/test/java/org/apache/camel/component/swagger/RestSwaggerReaderTest.java index a8d633d..041e421 100644 --- a/components/camel-swagger/src/test/java/org/apache/camel/component/swagger/RestSwaggerReaderTest.java +++ b/components/camel-swagger/src/test/java/org/apache/camel/component/swagger/RestSwaggerReaderTest.java @@ -18,7 +18,6 @@ package org.apache.camel.component.swagger; import com.wordnik.swagger.config.SwaggerConfig; import com.wordnik.swagger.model.ApiListing; -import junit.framework.TestCase; import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; @@ -26,9 +25,10 @@ import org.apache.camel.model.rest.RestDefinition; import org.junit.Ignore; import org.junit.Test; import scala.Option; -import scala.collection.immutable.Map; -public class RestSwaggerReaderTest extends TestCase { +import static org.junit.Assert.assertNotNull; + +public class RestSwaggerReaderTest { @Test @Ignore