Skip to content

Commit

Permalink
Restructure project into separate modules
Browse files Browse the repository at this point in the history
  • Loading branch information
cschoell committed Oct 12, 2023
1 parent d895a7e commit ec14440
Show file tree
Hide file tree
Showing 74 changed files with 205 additions and 2,198 deletions.
40 changes: 40 additions & 0 deletions bruno-model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>apiclient-converter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>bruno-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>bruno-model</name>
<description>Bruno Model description</description>
<properties>
<java.version>17</java.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public Folder(String name) {
}

public String getFolderName() {
return FileSystem.getCurrent().toLegalFileName(name, '_');
return org.apache.commons.io.FileSystem.getCurrent().toLegalFileName(name, '_');
}

List<BrunoRequestFile> requests = new LinkedList<>();
Expand Down
104 changes: 51 additions & 53 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,66 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>chris.postman.converter</groupId>
<artifactId>postman-converter</artifactId>

<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>apiclient-converter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>postman-converter</name>
<description>Tool to convert postman collections into different formats (e.g. Bruno)</description>
<description>Parent for the Tool to convert postman collections into different formats (e.g. Bruno)</description>
<properties>
<java.version>17</java.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<commons-io.version>2.14.0</commons-io.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
Expand All @@ -92,4 +84,10 @@
</plugins>
</build>

<modules>
<module>bruno-model</module>
<module>postman-model</module>
<module>postman-bruno-converter</module>
</modules>

</project>
76 changes: 76 additions & 0 deletions postman-bruno-converter/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>apiclient-converter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>postman-bruno-converter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>postman-bruno-converter</name>
<description>Bruno Model description</description>
<properties>
<java.version>17</java.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>postman-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>bruno-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
<dependency>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.util.stream.Collectors;

public class RequestContentBuilder {
public static final String DEFAULT_BODY_JSON = "json";
BrunoRequestFile brunoRequestFile;
StringBuilder content = new StringBuilder();

Expand Down Expand Up @@ -78,17 +77,7 @@ private List<PropertyDescriptor> getPropertyDescriptors(Class clazz) {
}
return sorted;
}
return Arrays.asList(PropertyUtils.getPropertyDescriptors(clazz)).stream().filter(propertyDescriptor -> !propertyDescriptor.getReadMethod().isAnnotationPresent(JsonIgnore.class)).toList();
}

private String getComponentName(PropertyDescriptor propertyDescriptor, Map<String, String> mapBean) throws IllegalAccessException, InvocationTargetException {
String componentName = propertyDescriptor.getName().toLowerCase();
try {
componentName = (String) PropertyUtils.getProperty(mapBean, "componentRootName");
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
return componentName;
return Arrays.stream(PropertyUtils.getPropertyDescriptors(clazz)).filter(propertyDescriptor -> !propertyDescriptor.getReadMethod().isAnnotationPresent(JsonIgnore.class)).toList();
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.cschoell.postman.converter;
package org.cschoell.postman.schematoobject;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Helper package to convert a postman collection json schema into Java Mappable Json Objects.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.cschoell.postman.converter.postmanconverter;
package org.cschoell.postman.schematoobject.postmanconverter;

import com.sun.codemodel.JCodeModel;
import org.jsonschema2pojo.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.cschoell.postman.converter.postmanconverter;
package org.cschoell.postman.schematoobject.postmanconverter;

import com.fasterxml.jackson.databind.JsonNode;
import com.sun.codemodel.JDefinedClass;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.cschoell.testsupport;

import com.fasterxml.jackson.databind.json.JsonMapper;
import org.cschoell.postman.converter.PostmanObjectMapperBuilder;
import org.cschoell.postman.schematoobject.PostmanObjectMapperBuilder;
import org.cschoell.postman.model.PostmanCollection;

import java.io.IOException;
Expand Down
31 changes: 31 additions & 0 deletions postman-model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.cschoell.apiclient.converter</groupId>
<artifactId>apiclient-converter-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>postman-model</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>postman-model</name>
<description>Bruno Model description</description>
<properties>
<java.version>17</java.version>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
</dependencies>
</project>
1 change: 0 additions & 1 deletion src/main/resources/application.properties

This file was deleted.

Loading

0 comments on commit ec14440

Please sign in to comment.