test_class.file: herd-build/herd-swaggergen-maven-plugin/src/test/java/org/finra/herd/swaggergen/SwaggerGenMojoTest.java
test_class.identifier: SwaggerGenMojoTest
test_class.superclass: extends AbstractTest
test_case.body: @Test
      public void test_1() throws Exception
      {
          File tempDir = Files.createTempDir();
          String outputFileName = "swagger.yaml";
  
          SwaggerGenMojo swaggerGenMojo = new SwaggerGenMojo();
          ReflectionTestUtils.setField(swaggerGenMojo, "outputDirectory", tempDir);
          ReflectionTestUtils.setField(swaggerGenMojo, "outputFilename", outputFileName);
          ReflectionTestUtils.setField(swaggerGenMojo, "restJavaPackage", "org.finra.herd.swaggergen.test.swaggerGenMojo.rest");
          ReflectionTestUtils.setField(swaggerGenMojo, "modelJavaPackage", "org.finra.herd.swaggergen.test.swaggerGenMojo.model");
          ReflectionTestUtils.setField(swaggerGenMojo, "modelErrorClassName", "ErrorResponse");
          ReflectionTestUtils.setField(swaggerGenMojo, "tagPatternParameter", "(?<tag>.+?)RestController");
          ReflectionTestUtils.setField(swaggerGenMojo, "title", "test_title");
          ReflectionTestUtils.setField(swaggerGenMojo, "version", "test_version");
          ReflectionTestUtils.setField(swaggerGenMojo, "basePath", "/test_basePath");
          ReflectionTestUtils.setField(swaggerGenMojo, "schemeParameters", Arrays.asList("http", "https"));
          swaggerGenMojo.execute();
  
          assertEquals(getResourceAsString("/yaml4.yaml"), getFileAsString(Paths.get(tempDir.getAbsolutePath(), outputFileName)));
      }
test_case.class_method_signature: SwaggerGenMojoTest.test_1()
test_case.full_signature: @Test public void test_1()
test_case.identifier: test_1
test_case.invocations: createTempDir setField setField setField setField setField setField setField setField setField setField asList execute assertEquals getResourceAsString getFileAsString get getAbsolutePath
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void test_1()
focal_class.declarator: outputDirectory
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "outputDir", required = true,
          defaultValue = "${project.build.directory}/generated-sources/herd-swaggergen")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "outputDir", required = true,
          defaultValue = "${project.build.directory}/generated-sources/herd-swaggergen")
      private File outputDirectory;
focal_class.type: File
focal_class.var_name: outputDirectory
focal_class.declarator: outputFilename
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "outputFilename", required = true, defaultValue = "swagger.yaml")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "outputFilename", required = true, defaultValue = "swagger.yaml")
      private String outputFilename;
focal_class.type: String
focal_class.var_name: outputFilename
focal_class.declarator: restJavaPackage
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "restJavaPackage", required = true)
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "restJavaPackage", required = true)
      private String restJavaPackage;
focal_class.type: String
focal_class.var_name: restJavaPackage
focal_class.declarator: modelJavaPackage
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "modelJavaPackage", required = true)
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "modelJavaPackage", required = true)
      private String modelJavaPackage;
focal_class.type: String
focal_class.var_name: modelJavaPackage
focal_class.declarator: modelErrorClassName
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "modelErrorClassName")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "modelErrorClassName")
      private String modelErrorClassName;
focal_class.type: String
focal_class.var_name: modelErrorClassName
focal_class.declarator: tagPatternParameter
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "tagPattern", required = true, defaultValue = "(?<tag>.+?)RestController")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "tagPattern", required = true, defaultValue = "(?<tag>.+?)RestController")
      private String tagPatternParameter;
focal_class.type: String
focal_class.var_name: tagPatternParameter
focal_class.declarator: title
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "title", required = true, defaultValue = "Application")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "title", required = true, defaultValue = "Application")
      private String title;
focal_class.type: String
focal_class.var_name: title
focal_class.declarator: version
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "version", required = true, defaultValue = "${project.version}")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "version", required = true, defaultValue = "${project.version}")
      private String version;
focal_class.type: String
focal_class.var_name: version
focal_class.declarator: basePath
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "basePath", required = true, defaultValue = "/rest")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "basePath", required = true, defaultValue = "/rest")
      private String basePath;
focal_class.type: String
focal_class.var_name: basePath
focal_class.declarator: schemeParameters
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "schemes")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "schemes")
      private List<String> schemeParameters;
focal_class.type: List<String>
focal_class.var_name: schemeParameters
focal_class.declarator: xsdName
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "xsdName", required = false)
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "xsdName", required = false)
      private String xsdName;
focal_class.type: String
focal_class.var_name: xsdName
focal_class.declarator: authType
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "authType")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "authType")
      private String authType;
focal_class.type: String
focal_class.var_name: authType
focal_class.declarator: applyOperationsFilter
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "applyOperationsFilter")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "applyOperationsFilter")
      private Boolean applyOperationsFilter;
focal_class.type: Boolean
focal_class.var_name: applyOperationsFilter
focal_class.declarator: includeOperations
focal_class.modifier: @org.apache.maven.plugins.annotations.Parameter(property = "includeOperations")
      private
focal_class.original_string: @org.apache.maven.plugins.annotations.Parameter(property = "includeOperations")
      private String[] includeOperations;
focal_class.type: String[]
focal_class.var_name: includeOperations
focal_class.declarator: SECURITY_SCHEME_DEFINITIONS =
          new ArrayList<>(Arrays.asList(new BasicAuthDefinition(), new OAuth2Definition(), new ApiKeyAuthDefinition()))
focal_class.modifier: private static final
focal_class.original_string: private static final List<SecuritySchemeDefinition> SECURITY_SCHEME_DEFINITIONS =
          new ArrayList<>(Arrays.asList(new BasicAuthDefinition(), new OAuth2Definition(), new ApiKeyAuthDefinition()));
focal_class.type: List<SecuritySchemeDefinition>
focal_class.var_name: SECURITY_SCHEME_DEFINITIONS
focal_class.file: herd-build/herd-swaggergen-maven-plugin/src/main/java/org/finra/herd/swaggergen/SwaggerGenMojo.java
focal_class.identifier: SwaggerGenMojo
focal_class.class_method_signature: SwaggerGenMojo.execute()
focal_class.full_signature: @Override public void execute()
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void execute()
focal_class.class_method_signature: SwaggerGenMojo.getSwagger()
focal_class.full_signature: private Swagger getSwagger()
focal_class.identifier: getSwagger
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: Swagger
focal_class.signature: Swagger getSwagger()
focal_class.class_method_signature: SwaggerGenMojo.createYamlFile(Swagger swagger)
focal_class.full_signature: private void createYamlFile(Swagger swagger)
focal_class.identifier: createYamlFile
focal_class.modifiers: private
focal_class.parameters: (Swagger swagger)
focal_class.return: void
focal_class.signature: void createYamlFile(Swagger swagger)
focal_class.superclass: extends AbstractMojo
focal_method.body: @Override
      public void execute() throws MojoExecutionException
      {
          // Create the output directory if it doesn't already exist.
          getLog().debug("Creating output directory \"" + outputDirectory + "\".");
          java.nio.file.Path outputDirectoryPath = Paths.get(outputDirectory.toURI());
          if (!Files.exists(outputDirectoryPath))
          {
              try
              {
                  Files.createDirectories(outputDirectoryPath);
              }
              catch (IOException e)
              {
                  throw new MojoExecutionException("Unable to create directory for output path \"" + outputDirectoryPath + "\".", e);
              }
          }
  
          // Get a new Swagger metadata object.
          Swagger swagger = getSwagger();
  
          // Find all the model classes.
          // Note: this needs to be done before we process the REST controllers below because it finds the modelErrorClass.
          ModelClassFinder modelClassFinder = new ModelClassFinder(getLog(), modelJavaPackage, modelErrorClassName);
  
          // Find and process all the REST controllers and add them to the Swagger metadata.
          RestControllerProcessor restControllerProcessor =
              new RestControllerProcessor(getLog(), swagger, restJavaPackage, tagPatternParameter, modelClassFinder.getModelErrorClass());
  
          XsdParser xsdParser = null;
          if (xsdName != null)
          {
              xsdParser = new XsdParser(xsdName);
          }
  
          // Generate the definitions into Swagger based on the model classes collected.
          new DefinitionGenerator(getLog(), swagger, restControllerProcessor.getExampleClassNames(), modelClassFinder.getModelClasses(), xsdParser);
  
          if (applyOperationsFilter != null && applyOperationsFilter.equals(Boolean.TRUE))
          {
              OperationsFilter specFilter = new OperationsFilter(includeOperations);
              swagger = new SpecFilter().filter(swagger, specFilter, null, null, null);
          }
  
          // Write to Swagger information to a YAML file.
          createYamlFile(swagger);
      }
focal_method.class_method_signature: SwaggerGenMojo.execute()
focal_method.full_signature: @Override public void execute()
focal_method.identifier: execute
focal_method.invocations: debug getLog get toURI exists createDirectories getSwagger getLog getLog getModelErrorClass getLog getExampleClassNames getModelClasses equals filter createYamlFile
focal_method.modifiers: @Override public
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void execute()