test_class.declarator: wd
test_class.modifier: private static
test_class.original_string: private static Path wd;
test_class.type: Path
test_class.var_name: wd
test_class.file: org.eclipse.winery.generators.ia/src/test/java/org/eclipse/winery/generators/ia/GeneratorTest.java
test_class.identifier: GeneratorTest
test_case.body: @Test
      public void testMultipleOpsWithInOutParams() throws Exception {
          TInterface i = new TInterface();
          i.setName("http://www.example.org/interfaces/lifecycle");
  
          TOperation op;
          TOperation.InputParameters input;
          TOperation.OutputParameters output;
          TParameter param;
  
          op = new TOperation();
          op.setName("install");
          i.getOperation().add(op);
  
          input = new TOperation.InputParameters();
          param = new TParameter();
          param.setName("VMIP");
          param.setType("xs:string");
          input.getInputParameter().add(param);
          param = new TParameter();
          param.setName("DBMSUsername");
          param.setType("xs:string");
          input.getInputParameter().add(param);
          op.setInputParameters(input);
  
          output = new TOperation.OutputParameters();
          param = new TParameter();
          param.setName("Output");
          param.setType("xs:string");
          output.getOutputParameter().add(param);
          op.setOutputParameters(output);
  
          op = new TOperation();
          op.setName("uninstall");
          i.getOperation().add(op);
  
          input = new TOperation.InputParameters();
          param = new TParameter();
          param.setName("SomeLongParameterName");
          param.setType("xs:string");
          input.getInputParameter().add(param);
          param = new TParameter();
          param.setName("Port");
          param.setType("xs:string");
          input.getInputParameter().add(param);
          op.setInputParameters(input);
  
          op.setOutputParameters(output);
  
          Generator gen = new Generator(i, "org.opentosca.ia.test", new URL("http://test.com"), "TestMultipleOpsWithInOutParams", wd.toFile());
          gen.generateProject();
      }
test_case.class_method_signature: GeneratorTest.testMultipleOpsWithInOutParams()
test_case.full_signature: @Test public void testMultipleOpsWithInOutParams()
test_case.identifier: testMultipleOpsWithInOutParams
test_case.invocations: setName setName add getOperation setName setType add getInputParameter setName setType add getInputParameter setInputParameters setName setType add getOutputParameter setOutputParameters setName add getOperation setName setType add getInputParameter setName setType add getInputParameter setInputParameters setOutputParameters toFile generateProject
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMultipleOpsWithInOutParams()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(Generator.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(Generator.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: PLACEHOLDER_JAVA_PACKAGE = "IA_PACKAGE"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLACEHOLDER_JAVA_PACKAGE = "IA_PACKAGE";
focal_class.type: String
focal_class.var_name: PLACEHOLDER_JAVA_PACKAGE
focal_class.declarator: PLACEHOLDER_NAMESPACE = "IA_NAMESPACE"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLACEHOLDER_NAMESPACE = "IA_NAMESPACE";
focal_class.type: String
focal_class.var_name: PLACEHOLDER_NAMESPACE
focal_class.declarator: PLACEHOLDER_CLASS_NAME = "IA_CLASS_NAME"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLACEHOLDER_CLASS_NAME = "IA_CLASS_NAME";
focal_class.type: String
focal_class.var_name: PLACEHOLDER_CLASS_NAME
focal_class.declarator: PLACEHOLDER_IA_ARTIFACT_TEMPLATE_UPLOAD_URL = "IA_ARTIFACT_TEMPLATE_UPLOAD_URL"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLACEHOLDER_IA_ARTIFACT_TEMPLATE_UPLOAD_URL = "IA_ARTIFACT_TEMPLATE_UPLOAD_URL";
focal_class.type: String
focal_class.var_name: PLACEHOLDER_IA_ARTIFACT_TEMPLATE_UPLOAD_URL
focal_class.declarator: PLACEHOLDER_GENERATED_WEBSERVICE_METHODS = "GENERATED_WEBSERVICE_METHODS"
focal_class.modifier: private static final
focal_class.original_string: private static final String PLACEHOLDER_GENERATED_WEBSERVICE_METHODS = "GENERATED_WEBSERVICE_METHODS";
focal_class.type: String
focal_class.var_name: PLACEHOLDER_GENERATED_WEBSERVICE_METHODS
focal_class.declarator: TEMPLATE_PROJECT_FOLDER = "template/project"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_PROJECT_FOLDER = "template/project";
focal_class.type: String
focal_class.var_name: TEMPLATE_PROJECT_FOLDER
focal_class.declarator: TEMPLATE_JAVA_FOLDER = "template/java"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_JAVA_FOLDER = "template/java";
focal_class.type: String
focal_class.var_name: TEMPLATE_JAVA_FOLDER
focal_class.declarator: TEMPLATE_JAVA_ABSTRACT_IA_SERVICE = "AbstractIAService.java.template"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_JAVA_ABSTRACT_IA_SERVICE = "AbstractIAService.java.template";
focal_class.type: String
focal_class.var_name: TEMPLATE_JAVA_ABSTRACT_IA_SERVICE
focal_class.declarator: TEMPLATE_JAVA_TEMPLATE_SERVICE = "TemplateService.java.template"
focal_class.modifier: private static final
focal_class.original_string: private static final String TEMPLATE_JAVA_TEMPLATE_SERVICE = "TemplateService.java.template";
focal_class.type: String
focal_class.var_name: TEMPLATE_JAVA_TEMPLATE_SERVICE
focal_class.declarator: tInterface
focal_class.modifier: private final
focal_class.original_string: private final TInterface tInterface;
focal_class.type: TInterface
focal_class.var_name: tInterface
focal_class.declarator: workingDir
focal_class.modifier: private final
focal_class.original_string: private final File workingDir;
focal_class.type: File
focal_class.var_name: workingDir
focal_class.declarator: outDir
focal_class.modifier: private final
focal_class.original_string: private final File outDir;
focal_class.type: File
focal_class.var_name: outDir
focal_class.declarator: name
focal_class.modifier: private final
focal_class.original_string: private final String name;
focal_class.type: String
focal_class.var_name: name
focal_class.declarator: javaPackage
focal_class.modifier: private final
focal_class.original_string: private final String javaPackage;
focal_class.type: String
focal_class.var_name: javaPackage
focal_class.declarator: namespace
focal_class.modifier: private final
focal_class.original_string: private final String namespace;
focal_class.type: String
focal_class.var_name: namespace
focal_class.declarator: iaArtifactTemplateUploadUrl
focal_class.modifier: private final
focal_class.original_string: private final URL iaArtifactTemplateUploadUrl;
focal_class.type: URL
focal_class.var_name: iaArtifactTemplateUploadUrl
focal_class.file: org.eclipse.winery.generators.ia/src/main/java/org/eclipse/winery/generators/ia/Generator.java
focal_class.identifier: Generator
focal_class.class_method_signature: Generator.Generator(TInterface tInterface, String packageAndNamespace, URL iaArtifactTemplateUploadUrl, String name, File workingDir)
focal_class.full_signature: public  Generator(TInterface tInterface, String packageAndNamespace, URL iaArtifactTemplateUploadUrl, String name, File workingDir)
focal_class.identifier: Generator
focal_class.modifiers: public
focal_class.parameters: (TInterface tInterface, String packageAndNamespace, URL iaArtifactTemplateUploadUrl, String name, File workingDir)
focal_class.signature:  Generator(TInterface tInterface, String packageAndNamespace, URL iaArtifactTemplateUploadUrl, String name, File workingDir)
focal_class.class_method_signature: Generator.generateProject()
focal_class.full_signature: public Path generateProject()
focal_class.identifier: generateProject
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Path
focal_class.signature: Path generateProject()
focal_class.class_method_signature: Generator.generateAndZipProject()
focal_class.full_signature: public File generateAndZipProject()
focal_class.identifier: generateAndZipProject
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: File
focal_class.signature: File generateAndZipProject()
focal_class.class_method_signature: Generator.generateJavaFile(File javaService)
focal_class.full_signature: private void generateJavaFile(File javaService)
focal_class.identifier: generateJavaFile
focal_class.modifiers: private
focal_class.parameters: (File javaService)
focal_class.return: void
focal_class.signature: void generateJavaFile(File javaService)
focal_class.class_method_signature: Generator.updateFilesRecursively(File folderOrFile)
focal_class.full_signature: private void updateFilesRecursively(File folderOrFile)
focal_class.identifier: updateFilesRecursively
focal_class.modifiers: private
focal_class.parameters: (File folderOrFile)
focal_class.return: void
focal_class.signature: void updateFilesRecursively(File folderOrFile)
focal_class.class_method_signature: Generator.packageProject(Path projectDir)
focal_class.full_signature: private File packageProject(Path projectDir)
focal_class.identifier: packageProject
focal_class.modifiers: private
focal_class.parameters: (Path projectDir)
focal_class.return: File
focal_class.signature: File packageProject(Path projectDir)
focal_class.class_method_signature: Generator.addFilesRecursively(File folderOrFile, String baseDir, ArchiveOutputStream zos)
focal_class.full_signature: private void addFilesRecursively(File folderOrFile, String baseDir, ArchiveOutputStream zos)
focal_class.identifier: addFilesRecursively
focal_class.modifiers: private
focal_class.parameters: (File folderOrFile, String baseDir, ArchiveOutputStream zos)
focal_class.return: void
focal_class.signature: void addFilesRecursively(File folderOrFile, String baseDir, ArchiveOutputStream zos)
focal_method.body: public Path generateProject() throws Exception {
          Path workingDirPath = this.workingDir.toPath();
          Files.createDirectories(workingDirPath);
  
          // directory to store the template files to generate the java files from
          Path javaTemplateDir = workingDirPath.resolve("../java");
          Files.createDirectories(javaTemplateDir);
  
          // Copy template project and template java files
          String s = this.getClass().getResource("").getPath();
          if (s.contains("jar!")) {
              Generator.LOGGER.trace("we work on a jar file");
              Generator.LOGGER.trace("Location of the current class: {}", s);
  
              // we have a jar file
              // format: file:/location...jar!...path-in-the-jar
              // we only want to have location :)
              int excl = s.lastIndexOf("!");
              s = s.substring(0, excl);
              s = s.substring("file:".length());
  
              try (JarFile jf = new JarFile(s);) {
                  Enumeration<JarEntry> entries = jf.entries();
                  while (entries.hasMoreElements()) {
                      JarEntry je = entries.nextElement();
                      String name = je.getName();
                      if (name.startsWith(Generator.TEMPLATE_PROJECT_FOLDER + "/") && (name.length() > (Generator.TEMPLATE_PROJECT_FOLDER.length() + 1))) {
                          // strip "template/" from the beginning to have paths without "template" starting relatively from the working dir
                          name = name.substring(Generator.TEMPLATE_PROJECT_FOLDER.length() + 1);
                          if (je.isDirectory()) {
                              // directory found
                              Path dir = workingDirPath.resolve(name);
                              Files.createDirectory(dir);
                          } else {
                              Path file = workingDirPath.resolve(name);
                              try (InputStream is = jf.getInputStream(je);) {
                                  Files.copy(is, file, StandardCopyOption.REPLACE_EXISTING);
                              }
                          }
                      } else if (name.startsWith(Generator.TEMPLATE_JAVA_FOLDER + "/") && (name.length() > (Generator.TEMPLATE_JAVA_FOLDER.length() + 1))) {
                          if (!je.isDirectory()) {
                              // we copy the file directly into javaTemplateDir
                              File f = new File(name);
                              Path file = javaTemplateDir.resolve(f.getName());
                              try (InputStream is = jf.getInputStream(je);) {
                                  Files.copy(is, file, StandardCopyOption.REPLACE_EXISTING);
                              }
                          }
                      }
                  }
              }
          } else {
              // we're running in debug mode, we can work on the plain file system
              File templateProjectDir = new File(this.getClass().getResource("/" + Generator.TEMPLATE_PROJECT_FOLDER).getFile());
              FileUtils.copyDirectory(templateProjectDir, this.workingDir);
  
              File javaTemplatesDir = new File(this.getClass().getResource("/" + Generator.TEMPLATE_JAVA_FOLDER).getFile());
              FileUtils.copyDirectory(javaTemplatesDir, javaTemplateDir.toFile());
          }
  
          // Create Java Code Folder
          String[] splitPkg = this.javaPackage.split("\\.");
          StringBuilder javaFolderString = new StringBuilder(this.workingDir.getAbsolutePath() + File.separator + "src" + File.separator + "main" + File.separator + "java");
          for (String value : splitPkg) {
              javaFolderString.append(File.separator).append(value);
          }
  
          // Copy and rename TEMPLATE_JAVA_TEMPLATE_SERVICE
          Path templateJavaService = javaTemplateDir.resolve(Generator.TEMPLATE_JAVA_TEMPLATE_SERVICE);
          File javaService = new File(javaFolderString + File.separator + this.name + ".java");
          Files.createDirectories(javaService.toPath().getParent());
          Files.copy(templateJavaService, javaService.toPath(), StandardCopyOption.REPLACE_EXISTING);
  
          this.generateJavaFile(javaService);
          this.updateFilesRecursively(this.workingDir);
  
          return this.workingDir.toPath();
      }
focal_method.class_method_signature: Generator.generateProject()
focal_method.full_signature: public Path generateProject()
focal_method.identifier: generateProject
focal_method.invocations: toPath createDirectories resolve createDirectories getPath getResource getClass contains trace trace lastIndexOf substring substring length entries hasMoreElements nextElement getName startsWith length length substring length isDirectory resolve createDirectory resolve getInputStream copy startsWith length length isDirectory resolve getName getInputStream copy getFile getResource getClass copyDirectory getFile getResource getClass copyDirectory toFile split getAbsolutePath append append resolve createDirectories getParent toPath copy toPath generateJavaFile updateFilesRecursively toPath
focal_method.modifiers: public
focal_method.parameters: ()
focal_method.return: Path
focal_method.signature: Path generateProject()