From 4851d7915b53a57ab0f320633ac19db27ea2acef Mon Sep 17 00:00:00 2001 From: Nadezhda Makarkina Date: Mon, 24 Aug 2015 18:37:18 +0300 Subject: [PATCH] Fixes #1206: old scala tests have been deleted --- .../test/java/io/swagger/models/Issue534.java | 2 - .../io/swagger}/models/SpecialOrderItem.java | 2 +- .../scala/1_3/converter/BoxedTypesTest.scala | 135 ----- .../1_3/converter/ByteConverterTest.scala | 38 -- .../converter/CaseClassConverterTest.scala | 73 --- .../1_3/converter/CovariantGetterTest.scala | 39 -- .../1_3/converter/CustomConverterTest.scala | 65 --- .../EnumConversionPropertyTest.scala | 48 -- .../scala/1_3/converter/HiddenFieldTest.scala | 42 -- .../converter/JodaDateTimeConverterTest.scala | 42 -- .../JodaLocalDateConverterTest.scala | 42 -- .../1_3/converter/JsonIgnoreModelTest.scala | 25 - .../JsonIgnorePropertiesModelTest.scala | 35 -- .../1_3/converter/JsonPropertyModelTest.scala | 25 - .../ListContainerConverterTest.scala | 26 - .../test/scala/1_3/converter/MapTest.scala | 44 -- .../1_3/converter/ModelConversionTest.scala | 85 --- .../ModelPropertyNameParserTest.scala | 27 - .../converter/ModelPropertyParserTest.scala | 49 -- .../1_3/converter/ModelPropertyTest.scala | 119 ----- .../ModelWithOptionalFieldsTest.scala | 34 -- .../1_3/converter/PojoConverterTest.scala | 105 ---- .../converter/PropertyAnnotationTest.scala | 30 -- .../converter/RequiredFieldModelTest.scala | 24 - .../scala/1_3/converter/ScalaEnumTest.scala | 61 --- .../converter/SnakeCaseConverterTest.scala | 113 ---- .../converter/XMLGregorianCalendarTest.scala | 43 -- .../1_3/converter/XmlElementNameTest.scala | 44 -- .../src/test/scala/1_3/models/ATM.java | 17 - .../models/ApiFirstRequiredFieldModel.java | 26 - .../src/test/scala/1_3/models/Bar1.java | 11 - .../src/test/scala/1_3/models/Baz1.java | 5 - .../src/test/scala/1_3/models/BazField1.java | 5 - .../src/test/scala/1_3/models/Children.java | 10 - .../src/test/scala/1_3/models/Currency.java | 6 - .../src/test/scala/1_3/models/EB.java | 18 - .../src/test/scala/1_3/models/Foo1.java | 24 - .../scala/1_3/models/JCovariantGetter.java | 27 - .../models/ModelWithAnnotationOnProperty.java | 18 - .../scala/1_3/models/ModelWithEnumField.java | 5 - .../1_3/models/ModelWithEnumProperty.java | 13 - .../1_3/models/ModelWithIgnoreAnnotation.java | 32 -- .../ModelWithIgnorePropertiesAnnotation.java | 33 -- .../1_3/models/ModelWithJsonProperty.java | 16 - .../ModelWithModelPropertyOverrides.java | 16 - .../1_3/models/ModelWithOptionalFields.java | 8 - .../1_3/models/ModelWithPrimitiveArray.java | 15 - .../scala/1_3/models/SModelWithEnum.scala | 30 -- .../src/test/scala/1_3/models/TestEnum.java | 14 - .../1_3/models/XmlElementFieldModel.java | 14 - .../models/XmlFirstRequiredFieldModel.java | 26 - .../src/test/scala/ScalaModelTest.scala | 163 ------ .../src/test/scala/ScalaTest.scala | 47 -- .../matchers/SerializationMatchers.scala | 27 - .../src/test/scala/models/Address.java | 16 - .../src/test/scala/models/Error.java | 30 -- .../src/test/scala/models/Person.java | 70 --- .../test/scala/models/ScalaCaseClasses.scala | 28 - .../models/composition/AbstractSignal.java | 22 - .../models/composition/AnalogSignal.java | 16 - .../test/scala/models/composition/Animal.java | 23 - .../models/composition/DigitalSignal.java | 16 - .../test/scala/models/composition/Human.java | 43 -- .../test/scala/models/composition/Pet.java | 20 - .../test/scala/models/composition/Signal.java | 23 - .../test/scala/specFiles/compositionTest.json | 83 --- .../src/test/scala/specFiles/petstore.json | 498 ------------------ 67 files changed, 1 insertion(+), 2930 deletions(-) rename modules/swagger-core/src/test/{scala => java/io/swagger}/models/SpecialOrderItem.java (74%) delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/BoxedTypesTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ByteConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/CaseClassConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/CovariantGetterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/CustomConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/EnumConversionPropertyTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/HiddenFieldTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/JodaDateTimeConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/JodaLocalDateConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/JsonIgnoreModelTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/JsonIgnorePropertiesModelTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/JsonPropertyModelTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ListContainerConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/MapTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ModelConversionTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyNameParserTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyParserTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ModelWithOptionalFieldsTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/PojoConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/PropertyAnnotationTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/RequiredFieldModelTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/ScalaEnumTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/SnakeCaseConverterTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/XMLGregorianCalendarTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/converter/XmlElementNameTest.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ATM.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ApiFirstRequiredFieldModel.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/Bar1.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/Baz1.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/BazField1.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/Children.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/Currency.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/EB.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/Foo1.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/JCovariantGetter.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithAnnotationOnProperty.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumField.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumProperty.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnoreAnnotation.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnorePropertiesAnnotation.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithJsonProperty.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithModelPropertyOverrides.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithOptionalFields.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/ModelWithPrimitiveArray.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/SModelWithEnum.scala delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/TestEnum.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/XmlElementFieldModel.java delete mode 100644 modules/swagger-core/src/test/scala/1_3/models/XmlFirstRequiredFieldModel.java delete mode 100644 modules/swagger-core/src/test/scala/ScalaModelTest.scala delete mode 100644 modules/swagger-core/src/test/scala/ScalaTest.scala delete mode 100644 modules/swagger-core/src/test/scala/matchers/SerializationMatchers.scala delete mode 100644 modules/swagger-core/src/test/scala/models/Address.java delete mode 100644 modules/swagger-core/src/test/scala/models/Error.java delete mode 100644 modules/swagger-core/src/test/scala/models/Person.java delete mode 100644 modules/swagger-core/src/test/scala/models/ScalaCaseClasses.scala delete mode 100644 modules/swagger-core/src/test/scala/models/composition/AbstractSignal.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/AnalogSignal.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/Animal.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/DigitalSignal.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/Human.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/Pet.java delete mode 100644 modules/swagger-core/src/test/scala/models/composition/Signal.java delete mode 100644 modules/swagger-core/src/test/scala/specFiles/compositionTest.json delete mode 100644 modules/swagger-core/src/test/scala/specFiles/petstore.json diff --git a/modules/swagger-core/src/test/java/io/swagger/models/Issue534.java b/modules/swagger-core/src/test/java/io/swagger/models/Issue534.java index 7873a4c0b7..e378efcc59 100644 --- a/modules/swagger-core/src/test/java/io/swagger/models/Issue534.java +++ b/modules/swagger-core/src/test/java/io/swagger/models/Issue534.java @@ -2,8 +2,6 @@ import io.swagger.annotations.ApiModelProperty; -import models.SpecialOrderItem; - import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import java.util.List; diff --git a/modules/swagger-core/src/test/scala/models/SpecialOrderItem.java b/modules/swagger-core/src/test/java/io/swagger/models/SpecialOrderItem.java similarity index 74% rename from modules/swagger-core/src/test/scala/models/SpecialOrderItem.java rename to modules/swagger-core/src/test/java/io/swagger/models/SpecialOrderItem.java index 653ca65266..b0546d0c9a 100644 --- a/modules/swagger-core/src/test/scala/models/SpecialOrderItem.java +++ b/modules/swagger-core/src/test/java/io/swagger/models/SpecialOrderItem.java @@ -1,4 +1,4 @@ -package models; +package io.swagger.models; public class SpecialOrderItem { public String name; diff --git a/modules/swagger-core/src/test/scala/1_3/converter/BoxedTypesTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/BoxedTypesTest.scala deleted file mode 100644 index 82f6105dbf..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/BoxedTypesTest.scala +++ /dev/null @@ -1,135 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.{ApiModel, ApiModelProperty} -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.annotation.meta.field - -@RunWith(classOf[JUnitRunner]) -class BoxedTypesTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "format a BoxedType" in { - val models = ModelConverters.getInstance().read(classOf[BoxedTypesIssue31]) - models.size should be(1) - - val model = models.get("BoxedTypesIssue31") - val properties = model.getProperties() - properties should not be (null) - properties.size should be(5) - - models should serializeToJson( - """{ - "BoxedTypesIssue31" : { - "type": "object", - "properties" : { - "stringSeq" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "stringOpt" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "intSeq" : { - "type" : "array", - "description" : "Integers in a Sequence Box", - "items" : { - "type" : "object" - } - }, - "intOpt" : { - "type" : "array", - "description" : "Integer in an Option Box", - "items" : { - "type" : "object" - } - }, - "justInt" : { - "type" : "integer", - "format" : "int32" - } - }, - "description" : "Options of boxed types produces an Object ref instead of correct type" - } -}""") - } - - it should "format a BoxedTypeWithDataType provided in the annotation for the boxed object types" in { - val models = ModelConverters.getInstance().read(classOf[BoxedTypesIssue31WithDataType]) - - models.size should be(1) - - val model = models.get("BoxedTypesIssue31WithDataType") - val properties = model.getProperties() - properties should not be (null) - properties.size should be(5) - - models should serializeToJson( - """{ - "BoxedTypesIssue31WithDataType" : { - "type": "object", - "properties" : { - "stringSeq" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "stringOpt" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "intSeq" : { - "type" : "array", - "description" : "Integers in a Sequence Box", - "items" : { - "type" : "integer", - "format" : "int32" - } - }, - "intOpt" : { - "type" : "integer", - "format" : "int32", - "description" : "Integer in an Option Box" - }, - "justInt" : { - "type" : "integer", - "format" : "int32" - } - }, - "description" : "Options of boxed types produces an Object ref instead of correct type, but can be overcome with dataType" - } -}""") - // model.properties.size should be(5) - // write(model) should be( """{"id":"BoxedTypesIssue31WithDataType","description":"Options of boxed types produces an Object ref instead of correct type, but can be overcome with dataType","properties":{"stringSeq":{"type":"array","items":{"type":"string"}},"stringOpt":{"type":"string"},"intSeq":{"type":"array","description":"Integers in a Sequence Box","items":{"type":"integer","format":"int32"}},"intOpt":{"type":"integer","format":"int32","description":"Integer in an Option Box"},"justInt":{"type":"integer","format":"int32"}}}""") - } -} - -@ApiModel(description = "Options of boxed types produces an Object ref instead of correct type") -case class BoxedTypesIssue31( - stringSeq: Seq[String], - stringOpt: Option[String], - @(ApiModelProperty@field)(value = "Integers in a Sequence Box") intSeq: Seq[Int], - @(ApiModelProperty@field)(value = "Integer in an Option Box") intOpt: Option[Int], - justInt: Int) - -// Get around the erasure by providing the dataType explicitly using the dataType common names. -@ApiModel(description = "Options of boxed types produces an Object ref instead of correct type, but can be overcome with dataType") -case class BoxedTypesIssue31WithDataType( - stringSeq: Seq[String], stringOpt: Option[String], - @(ApiModelProperty@field)(value = "Integers in a Sequence Box", dataType = "List[int]") intSeq: Seq[Int], - @(ApiModelProperty@field)(value = "Integer in an Option Box", dataType = "int") intOpt: Option[Int], - justInt: Int) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ByteConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ByteConverterTest.scala deleted file mode 100644 index 06da1bec52..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ByteConverterTest.scala +++ /dev/null @@ -1,38 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.beans.BeanProperty - -@RunWith(classOf[JUnitRunner]) -class ByteConverterTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - val models = ModelConverters.getInstance().read(classOf[ByteConverterModel]) - models should serializeToJson( - """{ - "ByteConverterModel" : { - "type": "object", - "properties" : { - "myBytes" : { - "type" : "array", - "items" : { - "type" : "string", - "format" : "byte" - } - } - } - } -}""") -} - -class ByteConverterModel { - @BeanProperty var myBytes: Array[java.lang.Byte] = _ -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/CaseClassConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/CaseClassConverterTest.scala deleted file mode 100644 index 5a71b4aa50..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/CaseClassConverterTest.scala +++ /dev/null @@ -1,73 +0,0 @@ -package converter - -import java.util.Date - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class CaseClassConverterTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - it should "read a simple case class" in { - val models = ModelConverters.getInstance().read(classOf[SimpleCaseClass]) - models.size should be(1) - - val model = models.get("SimpleCaseClass") - val properties = model.getProperties() - properties should not be (null) - properties.size should be(3) - properties.asScala.map { - _._1 - }.toSet should equal(Set("id", "name", "date")) - } - - it should "read a nested case class" in { - val models = ModelConverters.getInstance().read(classOf[NestedCaseClass]) - models.size should be(1) - - val model = models.get("NestedCaseClass") - val properties = model.getProperties() - properties should not be (null) - properties.asScala.map { - _._1 - }.toSet should equal(Set("id", "firstName", "innerObject")) - } - - it should "read a case class with Options" in { - val models = ModelConverters.getInstance().read(classOf[CaseClassWithOptions]) - models.size should be(1) - - val model = models.get("CaseClassWithOptions") - val properties = model.getProperties() - properties should not be (null) - properties.asScala.map { - _._1 - }.toSet should equal(Set("id", "firstName", "age")) - } -} - -case class SimpleCaseClass( - id: Long, - name: String, - date: Date - ) - -case class NestedCaseClass( - id: Long, - firstName: String, - innerObject: SimpleCaseClass - ) - -case class CaseClassWithOptions( - id: Long, - firstName: String, - age: Option[Int] - ) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/CovariantGetterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/CovariantGetterTest.scala deleted file mode 100644 index 2e05335799..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/CovariantGetterTest.scala +++ /dev/null @@ -1,39 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models.JCovariantGetter -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class CovariantGetterTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - it should "read a getter with covariant return type" in { - val models = ModelConverters.getInstance().read(classOf[JCovariantGetter.Sub]) - models.size should be(1) - models should serializeToJson( - """{ - "Sub" : { - "type":"object", - "properties" : { - "myProperty" : { - "type" : "integer", - "format" : "int32", - "position" : 1 - }, - "myOtherProperty" : { - "type" : "integer", - "format" : "int32", - "position" : 2 - } - } - } -}""") - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/CustomConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/CustomConverterTest.scala deleted file mode 100644 index 0b3aa94a16..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/CustomConverterTest.scala +++ /dev/null @@ -1,65 +0,0 @@ -package converter - -import java.lang.annotation.Annotation -import java.lang.reflect.Type - -import io.swagger.converter.{ModelConverter, ModelConverterContext, ModelConverters} -import io.swagger.models.Model -import io.swagger.models.properties.Property -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.beans.BeanProperty - -@RunWith(classOf[JUnitRunner]) -class CustomConverterTest extends FlatSpec with Matchers { - it should "ignore properties with type Bar" in { - // add the custom converter - val converters = new ModelConverters() - converters.addConverter(new CustomConverter()) - - val models = converters.read(classOf[Foo]) - - val model = models.get("Foo") - model should not be (null) - model.getProperties.size should be(1) - - val barProperty = model.getProperties.get("bar") - barProperty should be(null) - - val titleProperty = model.getProperties.get("title") - titleProperty should not be (null) - } -} - -class CustomConverter extends ModelConverter { - @Override - def resolveProperty(`type`: Type, context: ModelConverterContext, annotations: Array[Annotation], chain: java.util.Iterator[ModelConverter]): Property = { - val jType = Json.mapper().constructType(`type`) - if (jType != null) { - var cls = jType.getRawClass - if (cls.equals(classOf[Bar])) - null - else - chain.next().resolveProperty(`type`, context, annotations, chain); - } - else - null - } - - @Override - def resolve(`type`: Type, context: ModelConverterContext, chain: java.util.Iterator[ModelConverter]): Model = { - return chain.next().resolve(`type`, context, chain) - } -} - -class Foo { - @BeanProperty var bar: Bar = null - @BeanProperty var title: String = null -} - -class Bar { - @BeanProperty var foo: String = null -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/EnumConversionPropertyTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/EnumConversionPropertyTest.scala deleted file mode 100644 index c5e9b17abe..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/EnumConversionPropertyTest.scala +++ /dev/null @@ -1,48 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class EnumConversionPropertyTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - it should "read a model with an enum property" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithEnumProperty]) - models should serializeToJson( - """{ - "ModelWithEnumProperty" : { - "type": "object", - "properties" : { - "enumValue" : { - "type" : "string", - "enum" : [ "PRIVATE", "PUBLIC", "SYSTEM", "INVITE_ONLY" ] - } - } - } -}""") - } - - it should "read a model with enums" in { - val models = ModelConverters.getInstance().read(classOf[ATM]) - models should serializeToJson( - """{ - "ATM" : { - "type": "object", - "properties" : { - "currency" : { - "type" : "string", - "enum" : [ "USA", "CANADA" ] - } - } - } -}""") - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/HiddenFieldTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/HiddenFieldTest.scala deleted file mode 100644 index c0b4c66c25..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/HiddenFieldTest.scala +++ /dev/null @@ -1,42 +0,0 @@ -package converter - -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.{LongProperty, StringProperty} -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.beans.BeanProperty - -@RunWith(classOf[JUnitRunner]) -class HiddenFieldTest extends FlatSpec with Matchers { - it should "ignore a hidden field" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithHiddenFields]) - - val model = models.get("ModelWithHiddenFields") - model should not be (null) - model.getProperties.size should be(2) - - val idValue = model.getProperties.get("id") - idValue.isInstanceOf[LongProperty] should be(true) - idValue.getRequired should be(true) - - val nameValue = model.getProperties.get("name") - nameValue.isInstanceOf[StringProperty] should be(true) - } -} - -class ModelWithHiddenFields { - @BeanProperty - @ApiModelProperty(required = true) - var id: Long = _ - - @BeanProperty - @ApiModelProperty(required = true, hidden = false) - var name: String = _ - - @BeanProperty - @ApiModelProperty(hidden = true) - var password: String = _ -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/JodaDateTimeConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/JodaDateTimeConverterTest.scala deleted file mode 100644 index 6b2e0257d9..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/JodaDateTimeConverterTest.scala +++ /dev/null @@ -1,42 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.{DateTimeProperty, StringProperty} -import io.swagger.util.Json -import org.joda.time.DateTime -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.annotation.meta.field - -@RunWith(classOf[JUnitRunner]) -class JodaDateTimeConverterTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - it should "read a generic model" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithJodaDateTime]) - models.size should be(1) // don't create a Joda DateTime object - - val model = models.get("ModelWithJodaDateTime") - - val dateTimeProperty = model.getProperties.get("createdAt") - dateTimeProperty.isInstanceOf[DateTimeProperty] should be(true) - dateTimeProperty.getPosition should be(1) - dateTimeProperty.getRequired should be(true) - dateTimeProperty.getDescription should be("creation timestamp") - - val nameProperty = model.getProperties.get("name") - nameProperty.isInstanceOf[StringProperty] should be(true) - nameProperty.getPosition should be(2) - nameProperty.getDescription should be("name of the model") - } -} - - -case class ModelWithJodaDateTime( - @(ApiModelProperty@field)(value = "name of the model", position = 2) name: String, - @(ApiModelProperty@field)(value = "creation timestamp", required = true, position = 1) createdAt: DateTime) \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/JodaLocalDateConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/JodaLocalDateConverterTest.scala deleted file mode 100644 index a4f9483651..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/JodaLocalDateConverterTest.scala +++ /dev/null @@ -1,42 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.{DateProperty, StringProperty} -import io.swagger.util.Json -import org.joda.time.LocalDate -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.annotation.meta.field - -@RunWith(classOf[JUnitRunner]) -class JodaLocalDateConverterTest extends FlatSpec with Matchers { - val m = Json.mapper() - m.registerModule(DefaultScalaModule) - - it should "read a generic model" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithJodaLocalDate]) - models.size should be(1) - - val model = models.get("ModelWithJodaLocalDate") - - val dateTimeProperty = model.getProperties().get("createdAt") - dateTimeProperty.isInstanceOf[DateProperty] should be(true) - dateTimeProperty.getPosition should be(1) - dateTimeProperty.getRequired should be(true) - dateTimeProperty.getDescription should be("creation localDate") - - val nameProperty = model.getProperties().get("name") - nameProperty.isInstanceOf[StringProperty] should be(true) - nameProperty.getPosition should be(2) - nameProperty.getDescription should be("name of the model") - } -} - - -case class ModelWithJodaLocalDate( - @(ApiModelProperty@field)(value = "name of the model", position = 2) name: String, - @(ApiModelProperty@field)(value = "creation localDate", required = true, position = 1) createdAt: LocalDate) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnoreModelTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnoreModelTest.scala deleted file mode 100644 index 0646caa685..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnoreModelTest.scala +++ /dev/null @@ -1,25 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class JsonIgnoreModelTest extends FlatSpec with Matchers { - val models = ModelConverters.getInstance().read(classOf[ModelWithIgnoreAnnotation]) - models should serializeToJson( - """{ - "ModelWithIgnoreAnnotation" : { - "type":"object", - "properties" : { - "name" : { - "type" : "string" - } - } - } -}""") -} - diff --git a/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnorePropertiesModelTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnorePropertiesModelTest.scala deleted file mode 100644 index 25de9cf834..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/JsonIgnorePropertiesModelTest.scala +++ /dev/null @@ -1,35 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class JsonIgnorePropertiesModelTest extends FlatSpec with Matchers { - it should "ignore a property with ignore annotations" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithIgnorePropertiesAnnotation]) - models should serializeToJson( - """{ - "ModelWithIgnorePropertiesAnnotation" : { - "type": "object", - "properties" : { - "name" : { - "type" : "string" - }, - "favoriteAnimal" : { - "type" : "string" - } - } - } -}""") - } - - it should "ignore a property with superclass #767" in { - val models = ModelConverters.getInstance().read(classOf[Foo1]) - val model = models.get("Foo") - model.getProperties().containsKey("bazField") should be(false) - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/JsonPropertyModelTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/JsonPropertyModelTest.scala deleted file mode 100644 index 7708714fc2..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/JsonPropertyModelTest.scala +++ /dev/null @@ -1,25 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class JsonPropertyModelTest extends FlatSpec with Matchers { - val models = ModelConverters.getInstance().read(classOf[ModelWithJsonProperty]) - models should serializeToJson( - """{ - "ModelWithJsonProperty" : { - "type":"object", - "properties" : { - "theCount" : { - "type" : "integer", - "format" : "int32" - } - } - } -}""") -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ListContainerConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ListContainerConverterTest.scala deleted file mode 100644 index c86f17f447..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ListContainerConverterTest.scala +++ /dev/null @@ -1,26 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class ListContainerConverterTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "read a case class with List" in { - val models = ModelConverters.getInstance().read(classOf[CaseClassWithList]) - val keys = models.get("CaseClassWithList").getProperties().keySet().asScala.toSet - keys should be(Set("id", "kidsAges")) - } -} - -case class CaseClassWithList( - id: Long, - kidsAges: List[java.lang.Integer] - ) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/MapTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/MapTest.scala deleted file mode 100644 index 0fb8256813..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/MapTest.scala +++ /dev/null @@ -1,44 +0,0 @@ -package converter - -import java.util.Date - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.{DateTimeProperty, LongProperty, MapProperty} -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class MapTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "read a model with map and long value" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithLongMapValue]) - - val model = models.get("ModelWithLongMapValue") - val id = model.getProperties().get("id") - id.isInstanceOf[LongProperty] should be(true) - val p = model.getProperties().get("longMap") - p.isInstanceOf[MapProperty] should be(true) - val map = p.asInstanceOf[MapProperty] - map.getAdditionalProperties().isInstanceOf[LongProperty] should be(true) - } - - it should "read a model with map and date value" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithDateMapValue]) - - val model = models.get("ModelWithDateMapValue") - val id = model.getProperties().get("id") - id.isInstanceOf[LongProperty] should be(true) - val p = model.getProperties().get("dateMap") - p.isInstanceOf[MapProperty] should be(true) - val map = p.asInstanceOf[MapProperty] - map.getAdditionalProperties().isInstanceOf[DateTimeProperty] should be(true) - } -} - -case class ModelWithLongMapValue(id: Long, longMap: Map[String, java.lang.Long]) - -case class ModelWithDateMapValue(id: Long, dateMap: Map[String, Date]) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ModelConversionTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ModelConversionTest.scala deleted file mode 100644 index 3f91cf0134..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ModelConversionTest.scala +++ /dev/null @@ -1,85 +0,0 @@ -package converter - -import java.util.Date - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.annotation.meta.field - -@RunWith(classOf[JUnitRunner]) -class ModelConversionTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "format a date" in { - val models = ModelConverters.getInstance().read(classOf[DateModel]) - val model = models.get("DateModel") - model.getProperties().size should be(5) - model should serializeToJson( - """{ - "type": "object", - "properties" : { - "date" : { - "type" : "string", - "format" : "date-time", - "position" : 1 - }, - "intValue" : { - "type" : "integer", - "format" : "int32", - "position" : 2 - }, - "longValue" : { - "type" : "integer", - "format" : "int64", - "position" : 3 - }, - "floatValue" : { - "type" : "number", - "format" : "float", - "position" : 4 - }, - "doubleValue" : { - "type" : "number", - "format" : "double", - "position" : 5 - } - } -}""") - } - - it should "format a set" in { - val models = ModelConverters.getInstance().read(classOf[SetModel]) - val model = models.get("SetModel") - model.getProperties().size should be(1) - model should serializeToJson( - """{ - "type": "object", - "properties" : { - "longs" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "integer", - "format" : "int64" - } - } - } -}""") - } -} - -case class DateModel( - @(ApiModelProperty@field)(position = 1) date: Date, - @(ApiModelProperty@field)(position = 2) intValue: Int, - @(ApiModelProperty@field)(position = 3) longValue: Long, - @(ApiModelProperty@field)(position = 4) floatValue: Float, - @(ApiModelProperty@field)(position = 5) doubleValue: Double) - -case class SetModel(longs: Set[java.lang.Long]) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyNameParserTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyNameParserTest.scala deleted file mode 100644 index 5c650412fe..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyNameParserTest.scala +++ /dev/null @@ -1,27 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class ModelPropertyNameParserTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "parse property names correctly per #415" in { - val models = ModelConverters.getInstance().read(classOf[ModelPropertyNameClass]) - val model = models.get("ModelPropertyNameClass") - val keys = model.getProperties().keySet.asScala.toSet - keys should equal(Set("isometric", "is_persistent", "gettersAndHaters")) - } -} - -case class ModelPropertyNameClass( - is_persistent: Boolean, - isometric: Boolean, - gettersAndHaters: String) diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyParserTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyParserTest.scala deleted file mode 100644 index 25f0bf5192..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyParserTest.scala +++ /dev/null @@ -1,49 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.StringProperty -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class ModelPropertyParserTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "extract a string list" in { - val property = ModelConverters.getInstance().readAsProperty(classOf[List[String]]) - property should serializeToJson( - """{ - "type" : "array", - "items" : { - "type" : "object" - } -}""") - } - - it should "extract enum values from fields" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithEnumField]) - val model = models.get("ModelWithEnumField") - val enumProperty = model.getProperties().get("enumValue") - enumProperty.isInstanceOf[StringProperty] should be(true) - - val stringProperty = enumProperty.asInstanceOf[StringProperty] - stringProperty.getEnum().asScala.toSet should equal(Set("PRIVATE", "PUBLIC", "SYSTEM", "INVITE_ONLY")) - } - - it should "extract enum values from method return types" in { - val models = ModelConverters.getInstance().read(classOf[ModelWithEnumProperty]) - val model = models.get("ModelWithEnumProperty") - val enumProperty = model.getProperties().get("enumValue") - enumProperty.isInstanceOf[StringProperty] should be(true) - - val stringProperty = enumProperty.asInstanceOf[StringProperty] - stringProperty.getEnum().asScala.toSet should equal(Set("PRIVATE", "PUBLIC", "SYSTEM", "INVITE_ONLY")) - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyTest.scala deleted file mode 100644 index a9a78b3fd5..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ModelPropertyTest.scala +++ /dev/null @@ -1,119 +0,0 @@ -package converter - -import java.util.Date - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.models.properties._ -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class ModelPropertyTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "extract properties" in { - val models = ModelConverters.getInstance().readAll(classOf[Family]) - models.size should be(3) - val person = models.get("Person") - val employer = person.getProperties().get("employer") - - employer.isInstanceOf[ArrayProperty] should be(true) - val employerProperty = employer.asInstanceOf[ArrayProperty] - - val items = employerProperty.getItems - items.isInstanceOf[RefProperty] should be(true) - val itemsProperty = items.asInstanceOf[RefProperty] - itemsProperty.getSimpleRef() should equal("Employer") - - val awards = person.getProperties().get("awards") - awards.isInstanceOf[ArrayProperty] should be(true) - val awardsProperty = awards.asInstanceOf[ArrayProperty] - awardsProperty.getItems().isInstanceOf[StringProperty] should be(true) - } - - it should "extract a primitive array" in { - val models = ModelConverters.getInstance().readAll(classOf[ModelWithPrimitiveArray]) - - models.size should be(1) - val model = models.get("ModelWithPrimitiveArray") - val longArray = model.getProperties().get("longArray").asInstanceOf[ArrayProperty] - val longArrayItems = longArray.getItems() - longArrayItems.isInstanceOf[LongProperty] should be(true) - - val intArray = model.getProperties().get("intArray").asInstanceOf[ArrayProperty] - val awardItems = intArray.getItems() - awardItems.isInstanceOf[IntegerProperty] should be(true) - } - - it should "read a model property" in { - val models = ModelConverters.getInstance().readAll(classOf[IsModelTest]) - val model = models.get("IsModelTest") - model should not be (null) - } - - it should "read a scala object" in { - val models = ModelConverters.getInstance().readAll(classOf[Pet]) - models.size should be(1) - val model = models.get("Pet") - model.getProperties().get("name") should not be (null) - } -} - -@RunWith(classOf[JUnitRunner]) -class ModelPropertyOverrideTest extends FlatSpec with Matchers { - it should "read a model with property dataTypes configured #679" in { - val models = ModelConverters.getInstance().readAll(classOf[ModelWithModelPropertyOverrides]) - models should serializeToJson( - """{ - "Children" : { - "type": "object", - "properties" : { - "name" : { - "type" : "string" - } - } - }, - "ModelWithModelPropertyOverrides" : { - "type": "object", - "properties" : { - "children" : { - "type" : "array", - "items" : { - "$ref" : "#/definitions/Children" - } - } - } - } -}""") - } -} - -case class Family(membersSince: Date, members: List[Person]) - -class Pet { - var name: String = _ - var age: Int = 0 - var birthday: java.util.Date = _ -} - -case class Person( - firstname: String, - lastname: String, - middlename: Option[String], - age: Int, - birthday: Date, - employer: List[Employer], - awards: List[String]) - -case class Employer( - name: String, - size: Int) - -case class IsModelTest( - is_happy: Boolean, - name: String) \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ModelWithOptionalFieldsTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ModelWithOptionalFieldsTest.scala deleted file mode 100644 index d7ccd7d0b8..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ModelWithOptionalFieldsTest.scala +++ /dev/null @@ -1,34 +0,0 @@ -package converter - -import com.fasterxml.jackson.datatype.guava.GuavaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class ModelWithOptionalFieldsTest extends FlatSpec with Matchers { - Json.mapper().registerModule(new GuavaModule()) - - ignore should "read a model with guava optionals" in { - val property = ModelConverters.getInstance().readAll(classOf[ModelWithOptionalFields]) - property should serializeToJson( - """{ - "ModelWithOptionalFields" : { - "id" : "ModelWithOptionalFields", - "properties" : { - "string" : { - "type" : "string" - }, - "integer" : { - "type" : "integer", - "format" : "int32" - } - } - } -}""") - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/PojoConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/PojoConverterTest.scala deleted file mode 100644 index cbfcee032f..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/PojoConverterTest.scala +++ /dev/null @@ -1,105 +0,0 @@ -package converter - -import java.util.Date - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.beans.BeanProperty - -@RunWith(classOf[JUnitRunner]) -class PojoConverterTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - ignore should "ignore public fields without annotations" in { - val models = ModelConverters.getInstance().readAll(classOf[SimplePojo]) - val model = models.get("SimplePojo") - model.getProperties().size should equal(0) - } - - it should "sort by annotation hints" in { - val models = ModelConverters.getInstance().readAll(classOf[SimplePojoWithOrderPreserved]) - - val model = models.get("SimplePojoWithOrderPreserved") - val properties = model.getProperties() - val itr = properties.keySet().iterator() - - val id = properties.get(itr.next()) - id.getName should be("id") - val name = properties.get(itr.next()) - name.getName should be("name") - val date = properties.get(itr.next()) - date.getName should be("date") - } - - it should "read a simple pojo with BeanAnnotations" in { - val models = ModelConverters.getInstance().readAll(classOf[SimplePojoWithBeanAnnotations]) - - val model = models.get("SimplePojoWithBeanAnnotations") - val properties = model.getProperties() - val itr = properties.keySet().iterator() - - val id = properties.get(itr.next()) - id.getName should be("id") - val name = properties.get(itr.next()) - name.getName should be("name") - val date = properties.get(itr.next()) - date.getName should be("date") - } - - it should "read a simple pojo with getters and setters" in { - val models = ModelConverters.getInstance().readAll(classOf[SimplePojoWithGetterSetters]) - - val model = models.get("SimplePojoWithGetterSetters") - val properties = model.getProperties() - val itr = properties.keySet().iterator() - - val id = properties.get(itr.next()) - id.getName should be("id") - val name = properties.get(itr.next()) - name.getName should be("name") - val date = properties.get(itr.next()) - date.getName should be("date") - } -} - -class SimplePojo { - var id: Long = 0 - var name: String = _ - var date: Date = _ -} - -class SimplePojoWithOrderPreserved { - @ApiModelProperty(position = 0) var id: Long = 0 - @ApiModelProperty(position = 1) var name: String = _ - @ApiModelProperty(position = 2) var date: Date = _ -} - -class SimplePojoWithBeanAnnotations { - @BeanProperty var id: Long = 0 - @BeanProperty var name: String = _ - @BeanProperty var date: Date = _ -} - -class SimplePojoWithGetterSetters { - var id: Long = 0 - var name: String = _ - var date: Date = _ - - def getId(): Long = id - - def setId(id: Long) = this.id = id - - def getName(): String = name - - def setName(name: String) = this.name = name - - def getDate(): Date = date - - def setDate(date: Date) = this.date = date -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/PropertyAnnotationTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/PropertyAnnotationTest.scala deleted file mode 100644 index 7fb8863339..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/PropertyAnnotationTest.scala +++ /dev/null @@ -1,30 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import matchers.SerializationMatchers._ -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class PropertyAnnotationTest extends FlatSpec with Matchers { - it should "read annotations on a property" in { - val a = ModelConverters.getInstance().readAll(classOf[ModelWithAnnotationOnProperty]) - a should serializeToJson( - """{ - "ModelWithAnnotationOnProperty" : { - "type": "object", - "properties" : { - "count" : { - "type" : "integer", - "format" : "int32", - "position" : 1, - "description" : "the count of items" - } - }, - "description" : "my annotated model" - } -}""") - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/RequiredFieldModelTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/RequiredFieldModelTest.scala deleted file mode 100644 index 7d37ad01c5..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/RequiredFieldModelTest.scala +++ /dev/null @@ -1,24 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class RequiredFieldModelTest extends FlatSpec with Matchers { - it should "apply read only flag when ApiProperty annotation first" in { - val models = ModelConverters.getInstance().readAll(classOf[ApiFirstRequiredFieldModel]) - val model = models.get("aaa") - val prop = model.getProperties().get("a") - prop.getRequired() should be(true) - } - - it should "apply read only flag when XmlElement annotation first" in { - val models = ModelConverters.getInstance().readAll(classOf[XmlFirstRequiredFieldModel]) - val model = models.get("aaa") - val prop = model.getProperties().get("a") - prop.getRequired() should be(true) - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/ScalaEnumTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/ScalaEnumTest.scala deleted file mode 100644 index b1be8fdaea..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/ScalaEnumTest.scala +++ /dev/null @@ -1,61 +0,0 @@ -package converter - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class ScalaEnumTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - ignore should "format a class with a Scala Enum type specifying allowable enum values" in { - val models = ModelConverters.getInstance().readAll(classOf[SModelWithEnum]) - // model.properties.size should be(2) - - // Json.prettyPrint(models) - // Desired behavior is to have the - // "type": "string" - // "enum": ["TALL", "GRANDE", "VENTI"] - // modelStr should equal ("""{"id":"SModelWithEnum","description":"Scala model containing an Enumeration Value that is annotated with the dataType of the Enumeration class","properties":{"label":{"type":"string","description":"Textual label"},"orderSize":{"type":"string","description":"Order Size","enum":["GRANDE","TALL","VENTI"]}}}""") - /* - { - "id": "SModelWithEnum", - "description": "Scala model containing an Enumeration Value that is annotated with the dataType of the Enumeration class", - "properties": { - "label": { - "type": "string", - "description": "Textual label" - }, - "orderSize": { - "type": "string", - "description": "Order Size", - "enum": [ - "GRANDE", - "TALL", - "VENTI" - ] - } - } - }*/ - } - /* - it should "represent the Scala Enum Value type as a string without specifying allowable values if dataType is not specified" in { - val models = ModelConverters.getInstance().readAll(classOf[SModelWithEnumNoDataType]) - // model.properties.size should be(2) - // val modelStr = write(model) - // modelStr should equal ("""{"id":"SModelWithEnumNoDataType","description":"Scala model containing an Enumeration Value that is not annotated with the dataType of the Enumeration class","properties":{"label":{"type":"string","description":"Textual label"},"orderSize":{"type":"string","description":"Order Size"}}}""") - } - - it should "handle a Scala Enum Value type as a string without specifying allowable values if the dataType is badly specified" in { - val models = ModelConverters.getInstance().readAll(classOf[SModelWithEnumBadDataType]) - // model.properties.size should be(2) - // val modelStr = write(model) - // If the dataType cannot be resolved to an Enumeration class, just gracefully behave as if the dataType is not specified - // modelStr should equal ("""{"id":"SModelWithEnumBadDataType","description":"Scala model containing an Enumeration Value that is incorrectly annotated with a bad dataType of the Enumeration class","properties":{"label":{"type":"string","description":"Textual label"},"orderSize":{"type":"string","description":"Order Size"}}}""") - } - */ -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/SnakeCaseConverterTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/SnakeCaseConverterTest.scala deleted file mode 100644 index 3ffbaa0ffe..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/SnakeCaseConverterTest.scala +++ /dev/null @@ -1,113 +0,0 @@ -package converter - -import java.lang.annotation.Annotation -import java.lang.reflect.Type -import java.util.LinkedHashMap -import javax.xml.bind.annotation._ - -import io.swagger.converter.{ModelConverter, ModelConverterContext, ModelConverters} -import io.swagger.models.properties.{Property, RefProperty} -import io.swagger.models.{Model, ModelImpl} -import matchers.SerializationMatchers._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.beans.BeanProperty -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class SnakeCaseConverterTest extends FlatSpec with Matchers { - it should "ignore properties with type Bar" in { - // add the custom converter - val snakeCaseConverter = new SnakeCaseConverter - val converters = new ModelConverters() - - converters.addConverter(snakeCaseConverter) - - val models = converters.readAll(classOf[SnakeCaseModel]) - models should serializeToJson( - """{ - "bar" : { - "type": "object", - "properties" : { - "foo" : { - "type" : "string" - } - } - }, - "snake_case_model" : { - "type": "object", - "properties" : { - "bar" : { - "$ref" : "#/definitions/bar" - }, - "title" : { - "type" : "string" - } - }, - "xml" : { - "name" : "snakeCaseModel" - } - } -}""") - } -} - -@XmlRootElement(name = "snakeCaseModel") -class SnakeCaseModel { - @BeanProperty var bar: Bar = null - @BeanProperty var title: String = null -} - -/** - * simple converter to rename models and field names into snake_case - */ -class SnakeCaseConverter extends ModelConverter { - val primitives = Set("string", "integer", "number", "boolean", "long") - - def resolveProperty(`type`: Type, context: ModelConverterContext, annotations: Array[Annotation], chain: java.util.Iterator[ModelConverter]): Property = { - if (chain.hasNext()) { - val converter = chain.next() - return converter.resolveProperty(`type`, context, annotations, chain) - } - return null - } - - def resolve(`type`: Type, context: ModelConverterContext, chain: java.util.Iterator[ModelConverter]): Model = { - if (chain.hasNext()) { - val converter = chain.next() - val model = converter.resolve(`type`, context, chain) - if (model != null) { - val properties = model.getProperties() - val updatedProperties = new LinkedHashMap[String, Property] - for (key <- properties.keySet.asScala) { - val convertedKey = toSnakeCase(key) - val prop = properties.get(key) - if (prop.isInstanceOf[RefProperty]) { - val ref = prop.asInstanceOf[RefProperty] - ref.set$ref(toSnakeCase(ref.getSimpleRef())); - } - updatedProperties.put(convertedKey, prop) - } - model.getProperties().clear() - model.setProperties(updatedProperties) - val name = (model.asInstanceOf[ModelImpl]).getName - if (model.isInstanceOf[ModelImpl]) { - val impl = model.asInstanceOf[ModelImpl] - val prevName = impl.getName() - impl.setName(toSnakeCase(impl.getName())) - context.defineModel(impl.getName,impl,`type`,prevName) - } - return model - } - } - return null - } - - def toSnakeCase(str: String) = { - val o = "[A-Z\\d]".r.replaceAllIn(str, { m => "_" + m.group(0).toLowerCase() }) - if (o.startsWith("_")) o.substring(1) - else o - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/converter/XMLGregorianCalendarTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/XMLGregorianCalendarTest.scala deleted file mode 100644 index bcff9e0d19..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/XMLGregorianCalendarTest.scala +++ /dev/null @@ -1,43 +0,0 @@ -package converter - -import javax.xml.datatype.XMLGregorianCalendar - -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.annotations.ApiModelProperty -import io.swagger.converter.ModelConverters -import io.swagger.models.properties.{DateTimeProperty, StringProperty} -import io.swagger.util.Json -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.annotation.meta.field - -@RunWith(classOf[JUnitRunner]) -class XMLGregorianCalendarTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "read a model with XMLGregorianCalendar" in { - val models = ModelConverters.getInstance().readAll(classOf[ModelWithCalendar]) - models.size should be(1) // don't create a Joda DateTime object - - val model = models.get("ModelWithCalendar") - val properties = model.getProperties() - - val nameProperty = properties.get("name") - nameProperty.isInstanceOf[StringProperty] should be(true) - nameProperty.getPosition() should be(2) - nameProperty.getDescription() should be("name of the model") - - val dateTimeProperty = properties.get("createdAt") - dateTimeProperty.isInstanceOf[DateTimeProperty] should be(true) - dateTimeProperty.getPosition() should be(1) - dateTimeProperty.getRequired() should be(true) - dateTimeProperty.getDescription() should be("creation timestamp") - } -} - - -case class ModelWithCalendar( - @(ApiModelProperty@field)(value = "name of the model", position = 2) name: String, - @(ApiModelProperty@field)(value = "creation timestamp", required = true, position = 1) createdAt: XMLGregorianCalendar) \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/converter/XmlElementNameTest.scala b/modules/swagger-core/src/test/scala/1_3/converter/XmlElementNameTest.scala deleted file mode 100644 index d28cbecad7..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/converter/XmlElementNameTest.scala +++ /dev/null @@ -1,44 +0,0 @@ -package converter - -import io.swagger.converter.ModelConverters -import io.swagger.models.ModelImpl -import models._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class XmlElementNameTest extends FlatSpec with Matchers { - it should "honor XML Element Name" in { - val models = ModelConverters.getInstance().readAll(classOf[EB]) - models.size should be(1) - - val eb = models.get("EB") - val bar = eb.getProperties().get("bar") - val xml = bar.getXml() - xml should not be (null) - xml.getName() should equal("foo") - } - - // per https://github.com/swagger-api/swagger-core/issues/502 - it should "use the field name for both XmlElement and XmlAttribute annotations" in { - val models = ModelConverters.getInstance().readAll(classOf[XmlElementFieldModel]) - models.size should be(1) - - val eb = models.get("XmlElementFieldModel") - val name = eb.getProperties().get("name") - val xmlName = name.getXml() - xmlName should not be (null) - xmlName.getName() should equal("pet_name") - - val age = eb.getProperties().get("age") - val xmlAge = age.getXml() - xmlAge should not be (null) - xmlAge.getName() should equal("pet_age") - - eb.isInstanceOf[ModelImpl] should be(true) - val impl = eb.asInstanceOf[ModelImpl] - impl.getXml() should not be (null) - impl.getXml().getName() should equal("Pet") - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ATM.java b/modules/swagger-core/src/test/scala/1_3/models/ATM.java deleted file mode 100644 index 06819bbf26..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ATM.java +++ /dev/null @@ -1,17 +0,0 @@ -package models; - -import java.util.List; - -public class ATM { - private List supportedCurrencies; - - private Currency currency; - - public Currency getCurrency() { - return currency; - } - - public void setCurrency(Currency currency) { - this.currency = currency; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/ApiFirstRequiredFieldModel.java b/modules/swagger-core/src/test/scala/1_3/models/ApiFirstRequiredFieldModel.java deleted file mode 100644 index ba194e522e..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ApiFirstRequiredFieldModel.java +++ /dev/null @@ -1,26 +0,0 @@ -package models; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -@ApiModel(value = "aaa") -public class ApiFirstRequiredFieldModel { - @ApiModelProperty(value = "bla", required = true) - @XmlElement(name = "a") - public String getA() { - return "aaa"; - } - - public String getC() { - return "kkk"; - } - - ; -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/Bar1.java b/modules/swagger-core/src/test/scala/1_3/models/Bar1.java deleted file mode 100644 index 5f743c454c..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/Bar1.java +++ /dev/null @@ -1,11 +0,0 @@ -package models; - -public class Bar1 { - public Bar1(Baz1 baz) { - - } - - public BazField1 getBazField() { - return null; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/Baz1.java b/modules/swagger-core/src/test/scala/1_3/models/Baz1.java deleted file mode 100644 index 653574a91f..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/Baz1.java +++ /dev/null @@ -1,5 +0,0 @@ -package models; - -public class Baz1 { - -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/BazField1.java b/modules/swagger-core/src/test/scala/1_3/models/BazField1.java deleted file mode 100644 index 43f59e0c66..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/BazField1.java +++ /dev/null @@ -1,5 +0,0 @@ -package models; - -public class BazField1 { - -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/Children.java b/modules/swagger-core/src/test/scala/1_3/models/Children.java deleted file mode 100644 index a07ea7ad7b..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/Children.java +++ /dev/null @@ -1,10 +0,0 @@ -package models; - -public class Children { - public String getName() { - return null; - } - - public void setName(String name) { - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/Currency.java b/modules/swagger-core/src/test/scala/1_3/models/Currency.java deleted file mode 100644 index 6ea8e39248..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/Currency.java +++ /dev/null @@ -1,6 +0,0 @@ -package models; - -public enum Currency { - USA, - CANADA -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/EB.java b/modules/swagger-core/src/test/scala/1_3/models/EB.java deleted file mode 100644 index f68227d7f8..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/EB.java +++ /dev/null @@ -1,18 +0,0 @@ -package models; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class EB { - private String bar; - - @XmlElement(name = "foo") - public String getBar() { - return bar; - } - - public void setBar(String bar) { - this.bar = bar; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/Foo1.java b/modules/swagger-core/src/test/scala/1_3/models/Foo1.java deleted file mode 100644 index 04813dbfc0..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/Foo1.java +++ /dev/null @@ -1,24 +0,0 @@ -package models; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.annotations.ApiModel; - -@ApiModel(value = "Foo") -public class Foo1 extends Bar1 { - public Foo1(Baz1 baz) { - super(baz); - } - - @Override - @JsonIgnore - public BazField1 getBazField() { - return super.getBazField(); - } - - public String getOne() { - return null; - } - - public void setOne(String one) { - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/JCovariantGetter.java b/modules/swagger-core/src/test/scala/1_3/models/JCovariantGetter.java deleted file mode 100644 index b205adcf21..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/JCovariantGetter.java +++ /dev/null @@ -1,27 +0,0 @@ -package models; - -import io.swagger.annotations.ApiModelProperty; - -public abstract class JCovariantGetter { - @ApiModelProperty(position = 1) - public Object getMyProperty() { - return "42"; - } - - @ApiModelProperty(position = 2) - public Object getMyOtherProperty() { - return "42"; - } - - public static class Sub extends JCovariantGetter { - @Override - public Integer getMyProperty() { - return 42; - } - - @Override - public Integer getMyOtherProperty() { - return 42; - } - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithAnnotationOnProperty.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithAnnotationOnProperty.java deleted file mode 100644 index 6f70ac800e..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithAnnotationOnProperty.java +++ /dev/null @@ -1,18 +0,0 @@ -package models; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel(description = "my annotated model") -public class ModelWithAnnotationOnProperty { - @ApiModelProperty(value = "the count of items", position = 1) - private Integer count; - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumField.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumField.java deleted file mode 100644 index 7ee9751f23..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumField.java +++ /dev/null @@ -1,5 +0,0 @@ -package models; - -public class ModelWithEnumField { - public TestEnum enumValue; -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumProperty.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumProperty.java deleted file mode 100644 index 9f35c7abaa..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithEnumProperty.java +++ /dev/null @@ -1,13 +0,0 @@ -package models; - -public class ModelWithEnumProperty { - private TestEnum e; - - public TestEnum getEnumValue() { - return e; - } - - public void setEnumValue(TestEnum e) { - this.e = e; - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnoreAnnotation.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnoreAnnotation.java deleted file mode 100644 index 453cd73a09..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnoreAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -package models; - -import com.fasterxml.jackson.annotation.JsonIgnore; - -public class ModelWithIgnoreAnnotation { - private String name, ignoredString; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @JsonIgnore - public String getIgnoredString() { - return ignoredString; - } - - public void setIgnoredString(String ignoredString) { - this.ignoredString = ignoredString; - } - - @JsonIgnore - public String getMiddleName() { - return "ignore middle name"; - } - - public void setMiddleName(String name) { - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnorePropertiesAnnotation.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnorePropertiesAnnotation.java deleted file mode 100644 index 5913f5ed64..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithIgnorePropertiesAnnotation.java +++ /dev/null @@ -1,33 +0,0 @@ -package models; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; - -@JsonIgnoreProperties({"ignoredString", "middleName", "favoriteColor"}) -public class ModelWithIgnorePropertiesAnnotation { - public String favoriteColor; - public String favoriteAnimal; - private String name, ignoredString; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getIgnoredString() { - return ignoredString; - } - - public void setIgnoredString(String ignoredString) { - this.ignoredString = ignoredString; - } - - public String getMiddleName() { - return "ignore middle name"; - } - - public void setMiddleName(String name) { - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithJsonProperty.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithJsonProperty.java deleted file mode 100644 index cfd372db90..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithJsonProperty.java +++ /dev/null @@ -1,16 +0,0 @@ -package models; - -import com.fasterxml.jackson.annotation.JsonProperty; - -public class ModelWithJsonProperty { - @JsonProperty("theCount") - private Integer count; - - public Integer getCount() { - return count; - } - - public void setCount(Integer count) { - this.count = count; - } -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithModelPropertyOverrides.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithModelPropertyOverrides.java deleted file mode 100644 index 1629187ceb..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithModelPropertyOverrides.java +++ /dev/null @@ -1,16 +0,0 @@ -package models; - -import io.swagger.annotations.ApiModelProperty; - -public class ModelWithModelPropertyOverrides { - @ApiModelProperty(dataType = "List[models.Children]") - private String children; - - public String getChildren() { - return children; - } - - public void setChildren(String children) { - this.children = children; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithOptionalFields.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithOptionalFields.java deleted file mode 100644 index 43d43e7f47..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithOptionalFields.java +++ /dev/null @@ -1,8 +0,0 @@ -package models; - -import com.google.common.base.Optional; - -public class ModelWithOptionalFields { - public Optional string; - public Optional integer; -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/ModelWithPrimitiveArray.java b/modules/swagger-core/src/test/scala/1_3/models/ModelWithPrimitiveArray.java deleted file mode 100644 index 83b93a14df..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/ModelWithPrimitiveArray.java +++ /dev/null @@ -1,15 +0,0 @@ -package models; - -public class ModelWithPrimitiveArray { - public int[] intArray; - - private long[] longArray; - - public long[] getLongArray() { - return longArray; - } - - public void setLongArray(long[] longArray) { - this.longArray = longArray; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/SModelWithEnum.scala b/modules/swagger-core/src/test/scala/1_3/models/SModelWithEnum.scala deleted file mode 100644 index 2695f22d7b..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/SModelWithEnum.scala +++ /dev/null @@ -1,30 +0,0 @@ -package models - -import io.swagger.annotations.{ApiModel, ApiModelProperty} -import models.OrderSize.OrderSize - -import scala.annotation.meta.field - -@ApiModel(description = "Scala model containing an Enumeration Value that is annotated with the dataType of the Enumeration class") -case class SModelWithEnum( - @(ApiModelProperty@field)(value = "Textual label") label: Option[String] = None, - @(ApiModelProperty@field)(value = "Order Size", dataType = "models.OrderSize$") - orderSize: OrderSize = OrderSize.TALL) - -@ApiModel(description = "Scala model containing an Enumeration Value that is not annotated with the dataType of the Enumeration class") -case class SModelWithEnumNoDataType( - @(ApiModelProperty@field)(value = "Textual label") label: Option[String] = None, - @(ApiModelProperty@field)(value = "Order Size") orderSize: OrderSize = OrderSize.TALL) - -@ApiModel(description = "Scala model containing an Enumeration Value that is incorrectly annotated with a bad dataType of the Enumeration class") -case class SModelWithEnumBadDataType( - @(ApiModelProperty@field)(value = "Textual label") label: Option[String] = None, - @(ApiModelProperty@field)(value = "Order Size", dataType = "a.bad.dataType") orderSize: OrderSize = OrderSize.TALL) - - -case object OrderSize extends Enumeration(0) { - type OrderSize = Value - val TALL = Value("TALL") - val GRANDE = Value("GRANDE") - val VENTI = Value("VENTI") -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/TestEnum.java b/modules/swagger-core/src/test/scala/1_3/models/TestEnum.java deleted file mode 100644 index d0ceca4810..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/TestEnum.java +++ /dev/null @@ -1,14 +0,0 @@ -package models; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - -@XmlType -@XmlEnum(String.class) -public enum TestEnum { - @XmlEnumValue("PRIVATE")PRIVATE, - @XmlEnumValue("PUBLIC")PUBLIC, - @XmlEnumValue("SYSTEM")SYSTEM, - @XmlEnumValue("INVITE_ONLY")INVITE_ONLY; -} diff --git a/modules/swagger-core/src/test/scala/1_3/models/XmlElementFieldModel.java b/modules/swagger-core/src/test/scala/1_3/models/XmlElementFieldModel.java deleted file mode 100644 index ed1240a1c3..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/XmlElementFieldModel.java +++ /dev/null @@ -1,14 +0,0 @@ -package models; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Pet") -public class XmlElementFieldModel { - @XmlElement(name = "pet_name") - public String name; - - @XmlAttribute(name = "pet_age") - public Integer age; -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/1_3/models/XmlFirstRequiredFieldModel.java b/modules/swagger-core/src/test/scala/1_3/models/XmlFirstRequiredFieldModel.java deleted file mode 100644 index 304f185e0a..0000000000 --- a/modules/swagger-core/src/test/scala/1_3/models/XmlFirstRequiredFieldModel.java +++ /dev/null @@ -1,26 +0,0 @@ -package models; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -@ApiModel(value = "aaa") -public class XmlFirstRequiredFieldModel { - @XmlElement(name = "a") - @ApiModelProperty(value = "bla", required = true) - public String getA() { - return "aaa"; - } - - public String getC() { - return "kkk"; - } - - ; -} diff --git a/modules/swagger-core/src/test/scala/ScalaModelTest.scala b/modules/swagger-core/src/test/scala/ScalaModelTest.scala deleted file mode 100644 index 982d1b48f5..0000000000 --- a/modules/swagger-core/src/test/scala/ScalaModelTest.scala +++ /dev/null @@ -1,163 +0,0 @@ -import com.fasterxml.jackson.module.scala.DefaultScalaModule -import io.swagger.converter.ModelConverters -import io.swagger.models.ModelImpl -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import models._ -import models.composition.Pet -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -import scala.collection.JavaConverters._ - -@RunWith(classOf[JUnitRunner]) -class ScalaModelTest extends FlatSpec with Matchers { - Json.mapper().registerModule(DefaultScalaModule) - - it should "convert a simple scala case class" in { - val schemas = ModelConverters.getInstance().read(classOf[SimpleCaseClass]) - schemas should serializeToJson( - """{ - "SimpleCaseClass" : { - "type": "object", - "properties" : { - "name" : { - "type" : "string" - }, - "count" : { - "type" : "integer", - "format" : "int32" - } - } - } -}""") - } - - it should "convert a scala case class with List property" in { - val schemas = ModelConverters.getInstance().read(classOf[CaseClassWithList]) - schemas should serializeToJson( - """{ - "CaseClassWithList" : { - "type": "object", - "properties" : { - "name" : { - "type" : "string" - }, - "items" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } - } -}""") - } - - it should "convert a scala case class with optional value" in { - val schemas = ModelConverters.getInstance().read(classOf[CaseClassWithOptionLong]) - val props = (schemas.get("CaseClassWithOptionLong")).asInstanceOf[ModelImpl].getProperties() - val propertyCount = props.keySet.size - - val keys = props.keySet.asScala.toList - keys(0) should be("intValue") - keys(1) should be("longValue") - keys(2) should be("setValue") - keys(3) should be("dateValue") - keys(4) should be("booleanValue") - - schemas should serializeToJson( - """{ - "CaseClassWithOptionLong" : { - "type": "object", - "properties" : { - "intValue" : { - "type" : "integer", - "format" : "int32" - }, - "longValue" : { - "type" : "array", - "items" : { - "type" : "object" - } - }, - "setValue" : { - "type" : "array", - "uniqueItems" : true, - "items" : { - "type" : "string" - } - }, - "dateValue" : { - "type" : "string", - "format" : "date-time" - }, - "booleanValue" : { - "type" : "boolean", - "default": false - } - } - } -}""") - } - - it should "convert a scala case class with nested models" in { - val schemas = ModelConverters.getInstance().readAll(classOf[NestedModel]) - schemas should serializeToJson( - """{ - "ComplexModel" : { - "type": "object", - "properties" : { - "name" : { - "type" : "string" - }, - "age" : { - "type" : "integer", - "format" : "int32" - } - } - }, - "NestedModel" : { - "type": "object", - "properties" : { - "complexModel" : { - "$ref" : "#/definitions/ComplexModel" - }, - "localtime" : { - "type" : "string", - "format" : "date-time" - } - } - } -}""") - } - - it should "read an interface" in { - val schemas = ModelConverters.getInstance().readAll(classOf[Pet]) - schemas should serializeToJson( - """{ - "Pet" : { - "type": "object", - "required" : [ "isDomestic", "name", "type" ], - "properties" : { - "type" : { - "type" : "string", - "position" : 1, - "description" : "The pet type" - }, - "name" : { - "type" : "string", - "position" : 2, - "description" : "The name of the pet" - }, - "isDomestic" : { - "type" : "boolean", - "default": false, - "position" : 3 - } - } - } -}""") - } -} diff --git a/modules/swagger-core/src/test/scala/ScalaTest.scala b/modules/swagger-core/src/test/scala/ScalaTest.scala deleted file mode 100644 index 6f74601e08..0000000000 --- a/modules/swagger-core/src/test/scala/ScalaTest.scala +++ /dev/null @@ -1,47 +0,0 @@ -import io.swagger.converter.ModelConverters -import io.swagger.util.Json -import matchers.SerializationMatchers._ -import org.junit.runner.RunWith -import org.scalatest.{FlatSpec, Matchers} -import org.scalatest.junit.JUnitRunner - -@RunWith(classOf[JUnitRunner]) -class ScalaTest extends FlatSpec with Matchers { - val m = Json.mapper() - - it should "convert a model with scala list" in { - val schemas = ModelConverters.getInstance().read(classOf[ClassWithScalaField]) - schemas should serializeToJson( - """{ - "ClassWithScalaField" : { - "type": "object", - "properties" : { - "id" : { - "type" : "integer", - "format" : "int32" - }, - "name" : { - "type" : "string" - }, - "longField" : { - "type" : "integer", - "format" : "int64" - }, - "listOfStrings" : { - "type" : "array", - "items" : { - "type" : "string" - } - } - } - } -}""" - ) - } -} - -case class ClassWithScalaField(id: Int, - name: String, - longField: Long, - listOfStrings: List[String] - ) \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/matchers/SerializationMatchers.scala b/modules/swagger-core/src/test/scala/matchers/SerializationMatchers.scala deleted file mode 100644 index ccb71f1a69..0000000000 --- a/modules/swagger-core/src/test/scala/matchers/SerializationMatchers.scala +++ /dev/null @@ -1,27 +0,0 @@ -package matchers - -import com.fasterxml.jackson.databind.ObjectMapper -import com.fasterxml.jackson.databind.node.ObjectNode -import io.swagger.util.{Json, Yaml} -import org.scalatest.matchers.{MatchResult, Matcher} - -trait SerializationMatchers { - - def serializeToYaml(yamlStr: String) = new SerializeToStringMatcher(yamlStr, Yaml.mapper()) - - def serializeToJson(jsonStr: String) = new SerializeToStringMatcher(jsonStr, Json.mapper()) - - class SerializeToStringMatcher(str: String, mapper: ObjectMapper) extends Matcher[Object] { - def apply(left: Object) = { - val lhs = mapper.convertValue(left, classOf[ObjectNode]) - val rhs = mapper.readValue(str, classOf[ObjectNode]) - MatchResult( - lhs.equals(rhs), - s"""Serialized object:\n$lhs\ndoes not equal expected serialized string:\n$rhs"""", - s"""Serialized object equals expected serialized string"""" - ) - } - } -} - -object SerializationMatchers extends SerializationMatchers \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/Address.java b/modules/swagger-core/src/test/scala/models/Address.java deleted file mode 100644 index 35cbe13968..0000000000 --- a/modules/swagger-core/src/test/scala/models/Address.java +++ /dev/null @@ -1,16 +0,0 @@ -package models; - -import javax.xml.bind.annotation.XmlElement; - -public class Address { - private Integer streetNumber; - - @XmlElement(name = "streetNumber") - public Integer getStreetNumber() { - return streetNumber; - } - - public void setStreetNumber(Integer streetNumber) { - this.streetNumber = streetNumber; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/Error.java b/modules/swagger-core/src/test/scala/models/Error.java deleted file mode 100644 index 638a711328..0000000000 --- a/modules/swagger-core/src/test/scala/models/Error.java +++ /dev/null @@ -1,30 +0,0 @@ -package models; - -public class Error { - int code; - String message; - - public Error() { - } - - public Error(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/Person.java b/modules/swagger-core/src/test/scala/models/Person.java deleted file mode 100644 index cce94dcc78..0000000000 --- a/modules/swagger-core/src/test/scala/models/Person.java +++ /dev/null @@ -1,70 +0,0 @@ -package models; - -import java.util.Date; -import java.util.Map; - -public class Person { - private Long id; - private String firstName; - private Address address; - private Map properties; - private Date birthDate; - private Float floatValue; - private Double doubleValue; - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public Address getAddress() { - return address; - } - - public void setAddress(Address address) { - this.address = address; - } - - public Map getProperties() { - return properties; - } - - public void setProperties(Map properties) { - this.properties = properties; - } - - public Date getBirthDate() { - return birthDate; - } - - public void setBirthDate(Date birthDate) { - this.birthDate = birthDate; - } - - public Float getFloat() { - return floatValue; - } - - public void setFloat(Float floatValue) { - this.floatValue = floatValue; - } - - public Double getDouble() { - return doubleValue; - } - - public void setDouble(Double doubleValue) { - this.doubleValue = doubleValue; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/ScalaCaseClasses.scala b/modules/swagger-core/src/test/scala/models/ScalaCaseClasses.scala deleted file mode 100644 index dd992571c6..0000000000 --- a/modules/swagger-core/src/test/scala/models/ScalaCaseClasses.scala +++ /dev/null @@ -1,28 +0,0 @@ -package models - -import org.joda.time.DateTime - -case class SimpleCaseClass(name: String, count: Int) - -case class CaseClassWithList( - name: String, - items: List[String] - ) - -case class CaseClassWithOptionLong( - intValue: Int, - longValue: Option[Long], - setValue: Set[String], - dateValue: java.util.Date, - booleanValue: Boolean - ) - -case class NestedModel( - complexModel: ComplexModel, - localtime: DateTime - ) - -case class ComplexModel( - name: String, - age: Int - ) \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/composition/AbstractSignal.java b/modules/swagger-core/src/test/scala/models/composition/AbstractSignal.java deleted file mode 100644 index 007f16f40a..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/AbstractSignal.java +++ /dev/null @@ -1,22 +0,0 @@ -package models.composition; - -public abstract class AbstractSignal { - private int type; - private byte[] value; - - public int getType() { - return type; - } - - public void setType(int type) { - this.type = type; - } - - public byte[] getRawValue() { - return value; - } - - public void setRawValue(byte[] value) { - this.value = value; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/composition/AnalogSignal.java b/modules/swagger-core/src/test/scala/models/composition/AnalogSignal.java deleted file mode 100644 index 150ee8069b..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/AnalogSignal.java +++ /dev/null @@ -1,16 +0,0 @@ -package models.composition; - -import io.swagger.annotations.ApiModel; - -@ApiModel(description = "AnalogSignal", parent = Signal.class) -public class AnalogSignal extends AbstractSignal implements Signal { - private float analogValue; - - public float getAnalogValue() { - return analogValue; - } - - public void setAnalogValue(float analogValue) { - this.analogValue = analogValue; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/composition/Animal.java b/modules/swagger-core/src/test/scala/models/composition/Animal.java deleted file mode 100644 index 6c2ecae9ca..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/Animal.java +++ /dev/null @@ -1,23 +0,0 @@ -package models.composition; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.EXTERNAL_PROPERTY, - property = "type") -@JsonSubTypes({ - @Type(value = Human.class, name = "human"), - @Type(value = Pet.class, name = "pet") -}) -public interface Animal { - String getName(); - - void setName(String name); - - String getType(); - - void setType(String type); -} diff --git a/modules/swagger-core/src/test/scala/models/composition/DigitalSignal.java b/modules/swagger-core/src/test/scala/models/composition/DigitalSignal.java deleted file mode 100644 index 2f7582cf68..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/DigitalSignal.java +++ /dev/null @@ -1,16 +0,0 @@ -package models.composition; - -import io.swagger.annotations.ApiModel; - -@ApiModel(description = "AnalogSignal", parent = DigitalSignal.class) -public class DigitalSignal extends AbstractSignal implements Signal { - private boolean digitalValue; - - public boolean getDigitalValue() { - return digitalValue; - } - - public void setDigitalValue(boolean digitalValue) { - this.digitalValue = digitalValue; - } -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/composition/Human.java b/modules/swagger-core/src/test/scala/models/composition/Human.java deleted file mode 100644 index 97695c3025..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/Human.java +++ /dev/null @@ -1,43 +0,0 @@ -package models.composition; - -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonPropertyOrder({"name", "type", "firstName", "lastName"}) -public class Human implements Animal { - private String name; - private String type; - private String firstName; - private String lastName; - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFirstName() { - return firstName; - } - - public void setFirstName(String firstName) { - this.firstName = firstName; - } - - public String getLastName() { - return lastName; - } - - public void setLastName(String lastName) { - this.lastName = lastName; - } -} diff --git a/modules/swagger-core/src/test/scala/models/composition/Pet.java b/modules/swagger-core/src/test/scala/models/composition/Pet.java deleted file mode 100644 index e4e6ae814d..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/Pet.java +++ /dev/null @@ -1,20 +0,0 @@ -package models.composition; - -import io.swagger.annotations.ApiModelProperty; - -public interface Pet extends Animal { - @ApiModelProperty(position = 1, required = true, value = "The pet type") - String getType(); - - void setType(String type); - - @ApiModelProperty(position = 2, required = true, value = "The name of the pet") - String getName(); - - void setName(String name); - - @ApiModelProperty(position = 3, required = true) - Boolean getIsDomestic(); - - void setIsDomestic(Boolean isDomestic); -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/models/composition/Signal.java b/modules/swagger-core/src/test/scala/models/composition/Signal.java deleted file mode 100644 index 35bf1f9182..0000000000 --- a/modules/swagger-core/src/test/scala/models/composition/Signal.java +++ /dev/null @@ -1,23 +0,0 @@ -package models.composition; - -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; -import com.fasterxml.jackson.annotation.JsonTypeInfo; - -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.EXTERNAL_PROPERTY, - property = "type") -@JsonSubTypes({ - @Type(value = DigitalSignal.class, name = "digital"), - @Type(value = AnalogSignal.class, name = "analog") -}) -public interface Signal { - int getType(); - - void setType(int type); - - byte[] getRawValue(); - - void setRawValue(byte[] value); -} \ No newline at end of file diff --git a/modules/swagger-core/src/test/scala/specFiles/compositionTest.json b/modules/swagger-core/src/test/scala/specFiles/compositionTest.json deleted file mode 100644 index 65df99fd9b..0000000000 --- a/modules/swagger-core/src/test/scala/specFiles/compositionTest.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "swagger": 2.0, - "info": { - "description": "This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters", - "version": "1.0.0", - "title": "Swagger Petstore", - "termsOfService": "http://swagger.io/terms/", - "contact": { - "name": "apiteam@swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "basePath": "petstore.swagger.io:80/api", - "paths": {}, - "definitions": { - "Pet": { - "allOf": [ - { - "$ref": "Human" - }, - { - "$ref": "Animal" - }, - { - "$ref": "Bird" - }, - { - "properties": { - "isDomestic": { - "type": "boolean" - } - } - } - ] - }, - "Human": { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "The name of the human" - }, - "type": { - "type": "string" - }, - "firstName": { - "type": "string" - }, - "lastName": { - "type": "string" - } - }, - "discriminator": "type" - }, - "Animal": { - "required": [ - "hasLegs" - ], - "properties": { - "hasLegs": { - "type": "boolean" - } - }, - "discriminator": "hasLegs" - }, - "Bird": { - "required": [ - "hasWings" - ], - "properties": { - "hasWings": { - "type": "boolean" - } - }, - "discriminator": "hasWings" - } - } -} diff --git a/modules/swagger-core/src/test/scala/specFiles/petstore.json b/modules/swagger-core/src/test/scala/specFiles/petstore.json deleted file mode 100644 index 841bd7e830..0000000000 --- a/modules/swagger-core/src/test/scala/specFiles/petstore.json +++ /dev/null @@ -1,498 +0,0 @@ -{ - "swagger": "2.0", - "title": "Petstore Sample API", - "info": { - "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", - "title": "Petstore Sample API", - "contact": { - "name": "Swagger API Team" - }, - "license": { - "name": "MIT", - "url": "http://github.com/gruntjs/grunt/blob/master/LICENSE-MIT" - } - }, - "tags": [ - { - "name": "pet", - "description": "Everything about your Pets", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - }, - { - "name": "user", - "description": "Operations about user" - }, - { - "name": "store", - "description": "Access to Petstore orders", - "externalDocs": { - "description": "Find out more", - "url": "http://swagger.io" - } - } - ], - "host": "petstore.swagger.io", - "basePath": "/api", - "paths": { - "/pet": { - "put": { - "tags": [ - "pet" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Pet object that needs to be added to the store", - "required": false, - "schema": { - "$ref": "#/definitions/Pet" - } - } - ], - "responses": { - "405": { - "description": "Validation exception" - }, - "404": { - "description": "Pet not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - }, - "post": { - "tags": [ - "pet" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Pet object that needs to be added to the store", - "required": false, - "schema": { - "$ref": "#/definitions/Tag" - } - } - ], - "responses": { - "405": { - "description": "Invalid input" - } - } - } - }, - "/user/createWithList": { - "post": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of user object", - "required": false - } - ] - } - }, - "/store/order/{orderId}": { - "get": { - "tags": [ - "store" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "Order not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - }, - "delete": { - "tags": [ - "store" - ], - "parameters": [ - { - "name": "orderId", - "in": "path", - "description": "ID of the order that needs to be deleted", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "Order not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - } - }, - "/user/createWithArray": { - "post": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "List of user object", - "required": false, - "schema": { - "$ref": "#/definitions/User" - } - } - ] - } - }, - "/store/order": { - "post": { - "tags": [ - "store" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "order placed for purchasing the pet", - "required": false, - "schema": { - "$ref": "#/definitions/Order" - } - } - ], - "responses": { - "400": { - "description": "Invalid Order" - } - } - } - }, - "/pet/findByStatus": { - "get": { - "tags": [ - "pet" - ], - "parameters": [ - { - "name": "status", - "in": "query", - "description": "Status values that need to be considered for filter", - "required": false, - "type": "string" - } - ], - "responses": { - "400": { - "description": "Invalid status value" - } - } - } - }, - "/user/{username}": { - "get": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "The name that needs to be fetched. Use user1 for testing. ", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "User not found" - }, - "400": { - "description": "Invalid username supplied" - } - } - }, - "put": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "name that need to be deleted", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "description": "Updated user object", - "required": false, - "schema": { - "$ref": "#/definitions/User" - } - } - ], - "responses": { - "404": { - "description": "User not found" - }, - "400": { - "description": "Invalid user supplied" - } - } - }, - "delete": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "username", - "in": "path", - "description": "The name that needs to be deleted", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "User not found" - }, - "400": { - "description": "Invalid username supplied" - } - } - } - }, - "/pet/findByTags": { - "get": { - "tags": [ - "pet" - ], - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "Tags to filter by", - "required": false, - "type": "string" - } - ], - "responses": { - "400": { - "description": "Invalid tag value" - } - } - } - }, - "/user": { - "post": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "body", - "in": "body", - "description": "Created user object", - "required": false, - "schema": { - "$ref": "#/definitions/User" - } - } - ] - } - }, - "/pet/{petId}": { - "get": { - "tags": [ - "pet" - ], - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "ID of pet that needs to be fetched", - "required": true, - "type": "string" - } - ], - "responses": { - "404": { - "description": "Pet not found" - }, - "400": { - "description": "Invalid ID supplied" - } - } - } - }, - "/user/logout": { - "get": { - "tags": [ - "user" - ] - } - }, - "/user/login": { - "get": { - "tags": [ - "user" - ], - "parameters": [ - { - "name": "username", - "in": "query", - "description": "The user name for login", - "required": false, - "type": "string" - }, - { - "name": "password", - "in": "query", - "description": "The password for login in clear text", - "required": false, - "type": "string" - } - ], - "responses": { - "400": { - "description": "Invalid username/password supplied" - } - } - } - } - }, - "definitions": { - "User": { - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "lastName": { - "type": "string" - }, - "username": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "email": { - "type": "string" - }, - "userStatus": { - "type": "integer", - "format": "int32" - }, - "firstName": { - "type": "string" - }, - "password": { - "type": "string" - } - } - }, - "Category": { - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Pet": { - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "tags": { - "type": "array", - "items": { - "$ref": "#/definitions/Tag" - } - }, - "category": { - "$ref": "#/definitions/Category" - }, - "status": { - "type": "string" - }, - "name": { - "type": "string" - }, - "photoUrls": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "Tag": { - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "name": { - "type": "string" - } - } - }, - "Order": { - "properties": { - "id": { - "type": "integer", - "format": "int32" - }, - "petId": { - "type": "integer", - "format": "int32" - }, - "status": { - "type": "string" - }, - "complete": { - "type": "boolean" - }, - "quantity": { - "type": "integer", - "format": "int32" - }, - "shipDate": { - "type": "string", - "format": "date-time" - } - } - } - } -} \ No newline at end of file