Class SwaggerJavaTestGenerator
- java.lang.Object
-
- com.consol.citrus.generate.AbstractTestGenerator<T>
-
- com.consol.citrus.generate.javadsl.JavaTestGenerator<T>
-
- com.consol.citrus.generate.javadsl.JavaDslTestGenerator<T>
-
- com.consol.citrus.generate.javadsl.MessagingJavaTestGenerator<SwaggerJavaTestGenerator>
-
- com.consol.citrus.generate.javadsl.SwaggerJavaTestGenerator
-
- All Implemented Interfaces:
SwaggerTestGenerator<SwaggerJavaTestGenerator>,TestGenerator<SwaggerJavaTestGenerator>
public class SwaggerJavaTestGenerator extends MessagingJavaTestGenerator<SwaggerJavaTestGenerator> implements SwaggerTestGenerator<SwaggerJavaTestGenerator>
Test generator creates one to many test cases based on operations defined in a XML schema XSD.- Since:
- 2.7.4
- Author:
- Christoph Deppisch
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.consol.citrus.generate.TestGenerator
TestGenerator.GeneratorMode
-
-
Field Summary
-
Fields inherited from class com.consol.citrus.generate.AbstractTestGenerator
log, self
-
-
Constructor Summary
Constructors Constructor Description SwaggerJavaTestGenerator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate()Create tests with this generator.protected com.squareup.javapoet.JavaFile.BuildercreateJavaFileBuilder(com.squareup.javapoet.TypeSpec.Builder testTypeBuilder)StringgetContextPath()Gets the contextPath.StringgetNamePrefix()Gets the namePrefix.StringgetNameSuffix()Gets the nameSuffix.StringgetOperation()Gets the operation.StringgetSwaggerResource()Gets the swaggerResource.voidsetContextPath(String contextPath)Sets the contextPath.voidsetNamePrefix(String namePrefix)Sets the namePrefix.voidsetNameSuffix(String nameSuffix)Sets the nameSuffix.voidsetOperation(String operation)Sets the operation.voidsetSwaggerResource(String swaggerResource)Sets the swaggerResource.SwaggerJavaTestGeneratorwithContextPath(String contextPath)Set the server context path to use.SwaggerJavaTestGeneratorwithInboundMappingFile(String mappingFile)Add inbound JsonPath expression mappings file to manipulate inbound message content.SwaggerJavaTestGeneratorwithInboundMappings(Map<String,String> mappings)Add inbound JsonPath expression mappings to manipulate inbound message content.SwaggerJavaTestGeneratorwithNamePrefix(String prefix)Set the test name prefix to use.SwaggerJavaTestGeneratorwithNameSuffix(String suffix)Set the test name suffix to use.SwaggerJavaTestGeneratorwithOperation(String operation)Set the swagger operation to use.SwaggerJavaTestGeneratorwithOutboundMappingFile(String mappingFile)Add outbound JsonPath expression mappings file to manipulate outbound message content.SwaggerJavaTestGeneratorwithOutboundMappings(Map<String,String> mappings)Add outbound JsonPath expression mappings to manipulate outbound message content.SwaggerJavaTestGeneratorwithSpec(String swaggerResource)Set the swagger Open API resource to use.-
Methods inherited from class com.consol.citrus.generate.javadsl.MessagingJavaTestGenerator
addRequestHeader, addResponseHeader, generateInboundMessage, generateOutboundMessage, getActions, getEndpoint, getReceiveRequestCodeProvider, getReceiveResponseCodeProvider, getSendRequestCodeProvider, getSendResponseCodeProvider, setEndpoint, withEndpoint, withRequest, withResponse
-
Methods inherited from class com.consol.citrus.generate.javadsl.JavaDslTestGenerator
getBaseExtension, getCitrusAnnotation
-
Methods inherited from class com.consol.citrus.generate.javadsl.JavaTestGenerator
createAnnotationBuilder, getBaseType, getMode, getSrcDirectory, setMode, withMode
-
Methods inherited from class com.consol.citrus.generate.AbstractTestGenerator
getAuthor, getCreationDate, getDescription, getFileExtension, getFramework, getMethodName, getName, getPackage, getTargetFile, getTargetPackage, getUpdateDateTime, isDisabled, setAuthor, setDescription, setDisabled, setFileExtension, setFramework, setName, setPackage, setSrcDirectory, setTargetPackage, usePackage, useSrcDirectory, withAuthor, withDescription, withDisabled, withFileExtension, withFramework, withName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.consol.citrus.generate.SwaggerTestGenerator
withEndpoint
-
Methods inherited from interface com.consol.citrus.generate.TestGenerator
getAuthor, getDescription, getFramework, getMode, getName, getTargetPackage, isDisabled, usePackage, useSrcDirectory, withAuthor, withDescription, withDisabled, withFramework, withMode, withName
-
-
-
-
Method Detail
-
createJavaFileBuilder
protected com.squareup.javapoet.JavaFile.Builder createJavaFileBuilder(com.squareup.javapoet.TypeSpec.Builder testTypeBuilder)
- Overrides:
createJavaFileBuilderin classMessagingJavaTestGenerator<SwaggerJavaTestGenerator>
-
create
public void create()
Description copied from interface:TestGeneratorCreate tests with this generator.- Specified by:
createin interfaceTestGenerator<SwaggerJavaTestGenerator>- Overrides:
createin classJavaTestGenerator<SwaggerJavaTestGenerator>
-
withSpec
public SwaggerJavaTestGenerator withSpec(String swaggerResource)
Set the swagger Open API resource to use.- Specified by:
withSpecin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
swaggerResource-- Returns:
-
withContextPath
public SwaggerJavaTestGenerator withContextPath(String contextPath)
Set the server context path to use.- Parameters:
contextPath-- Returns:
-
withNamePrefix
public SwaggerJavaTestGenerator withNamePrefix(String prefix)
Set the test name prefix to use.- Specified by:
withNamePrefixin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
prefix-- Returns:
-
withNameSuffix
public SwaggerJavaTestGenerator withNameSuffix(String suffix)
Set the test name suffix to use.- Specified by:
withNameSuffixin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
suffix-- Returns:
-
withOperation
public SwaggerJavaTestGenerator withOperation(String operation)
Set the swagger operation to use.- Specified by:
withOperationin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
operation-- Returns:
-
withInboundMappings
public SwaggerJavaTestGenerator withInboundMappings(Map<String,String> mappings)
Add inbound JsonPath expression mappings to manipulate inbound message content.- Specified by:
withInboundMappingsin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
mappings-- Returns:
-
withOutboundMappings
public SwaggerJavaTestGenerator withOutboundMappings(Map<String,String> mappings)
Add outbound JsonPath expression mappings to manipulate outbound message content.- Specified by:
withOutboundMappingsin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
mappings-- Returns:
-
withInboundMappingFile
public SwaggerJavaTestGenerator withInboundMappingFile(String mappingFile)
Add inbound JsonPath expression mappings file to manipulate inbound message content.- Specified by:
withInboundMappingFilein interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
mappingFile-- Returns:
-
withOutboundMappingFile
public SwaggerJavaTestGenerator withOutboundMappingFile(String mappingFile)
Add outbound JsonPath expression mappings file to manipulate outbound message content.- Specified by:
withOutboundMappingFilein interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Parameters:
mappingFile-- Returns:
-
getSwaggerResource
public String getSwaggerResource()
Gets the swaggerResource.- Specified by:
getSwaggerResourcein interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Returns:
-
setSwaggerResource
public void setSwaggerResource(String swaggerResource)
Sets the swaggerResource.- Parameters:
swaggerResource-
-
getContextPath
public String getContextPath()
Gets the contextPath.- Returns:
-
setContextPath
public void setContextPath(String contextPath)
Sets the contextPath.- Parameters:
contextPath-
-
setNameSuffix
public void setNameSuffix(String nameSuffix)
Sets the nameSuffix.- Parameters:
nameSuffix-
-
getNameSuffix
public String getNameSuffix()
Gets the nameSuffix.- Specified by:
getNameSuffixin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Returns:
-
setNamePrefix
public void setNamePrefix(String namePrefix)
Sets the namePrefix.- Parameters:
namePrefix-
-
getNamePrefix
public String getNamePrefix()
Gets the namePrefix.- Returns:
-
setOperation
public void setOperation(String operation)
Sets the operation.- Parameters:
operation-
-
getOperation
public String getOperation()
Gets the operation.- Specified by:
getOperationin interfaceSwaggerTestGenerator<SwaggerJavaTestGenerator>- Returns:
-
-