-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77a92c6
commit 075cd6c
Showing
8 changed files
with
581 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
target/ | ||
pom.xml.tag | ||
pom.xml.releaseBackup | ||
pom.xml.versionsBackup | ||
pom.xml.next | ||
release.properties | ||
dependency-reduced-pom.xml | ||
buildNumber.properties | ||
.mvn/timing.properties | ||
|
||
.DS_Store | ||
|
||
# Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) | ||
!/.mvn/wrapper/maven-wrapper.jar | ||
|
||
.idea | ||
*.iml | ||
|
||
**/*.classpath | ||
**/*.project | ||
**/*.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: '1.0' | ||
steps: | ||
TagReleaseName: | ||
title: Setup RELEASE_NAME variable with tag | ||
image: alpine/git | ||
when: | ||
condition: | ||
all: | ||
releaseNameNotDefined: "${{TAG_REPO}} == true" | ||
commands: | ||
- cf_export RELEASE_NAME=${{TAG_NAME}} | ||
|
||
BranchReleaseName: | ||
title: Setup RELEASE_NAME variable with branch name | ||
image: alpine/git | ||
when: | ||
condition: | ||
all: | ||
releaseNameNotDefined: "${{TAG_REPO}} == false" | ||
commands: | ||
- cf_export RELEASE_NAME=${{GLOBAL_RELEASE_VERSION}}.${{CF_BRANCH_TAG_NORMALIZED}} | ||
|
||
Build: | ||
title: Maven build | ||
image: r.cfcr.io/regnosysops/regnosys/mvn-docker-build:latest | ||
working_directory: ./ | ||
commands: | ||
- rm -rf /codefresh/volume/.m2/com/regnosys /codefresh/volume/.m2/com/isda | ||
- mvn -s /settings.xml versions:set -DnewVersion=${{RELEASE_NAME}} | ||
- mvn -s /settings.xml versions:update-property -Dproperty=com.regnosys.rosetta.version -DnewVersion=[${{RELEASE_NAME}}] -DallowSnapshots=true -DallowDowngrade=true | ||
- mvn -U -s /settings.xml clean deploy | ||
|
||
TagRepo: | ||
title: Tag git repo with release name | ||
image: alpine/git | ||
when: | ||
condition: | ||
all: | ||
isRelease: "${{TAG_REPO}}" | ||
commands: | ||
- echo This is a release build, tag repos with release name [${{RELEASE_NAME}}] | ||
- git fetch --prune https://regnosys-ops:O6pl6qXtQLk6Z8KO2QFEcY@github.com/REGnosys/${{CF_REPO_NAME}}.git "+refs/tags/*:refs/tags/*" | ||
- git tag ${{RELEASE_NAME}} | ||
- git push https://regnosys-ops:O6pl6qXtQLk6Z8KO2QFEcY@github.com/REGnosys/${{CF_REPO_NAME}}.git ${{RELEASE_NAME}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.regnosys</groupId> | ||
<artifactId>rosetta-common</artifactId> | ||
<packaging>pom</packaging> | ||
<version>0.0.0.master</version> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<java.version>1.8</java.version> | ||
<junit.jupiter.version>5.0.3</junit.jupiter.version> | ||
<junit.platform.version>1.0.0</junit.platform.version> | ||
<reflections.version>0.9.11</reflections.version> | ||
<com.regnosys.rosetta.version>0.0.0.master</com.regnosys.rosetta.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.regnosys.rosetta</groupId> | ||
<artifactId>com.regnosys.rosetta.lib</artifactId> | ||
<version>${com.regnosys.rosetta.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.reflections</groupId> | ||
<artifactId>reflections</artifactId> | ||
<version>${reflections.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>java-hamcrest</artifactId> | ||
<version>2.0.0.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<version>2.10.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-launcher</artifactId> | ||
<version>${junit.platform.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-params</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit.jupiter.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>license-maven-plugin</artifactId> | ||
<version>1.16</version> | ||
<executions> | ||
<execution> | ||
<id>download-licenses</id> | ||
<goals> | ||
<goal>aggregate-download-licenses</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-core</artifactId> | ||
<version>1.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.doxia</groupId> | ||
<artifactId>doxia-site-renderer</artifactId> | ||
<version>1.6</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
<configuration> | ||
<port>9000</port> | ||
<tempWebappDirectory>${basedir}/target/site</tempWebappDirectory> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<distributionManagement> | ||
<repository> | ||
<id>snapshots</id> | ||
<name>libs-snapshots</name> | ||
<url>https://regnosys.jfrog.io/regnosys/libs-snapshot-local</url> | ||
</repository> | ||
</distributionManagement> | ||
|
||
<reporting> | ||
<plugins> | ||
<!-- | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
<reportSets> | ||
<reportSet> | ||
<reports> | ||
<report>index</report> | ||
</reports> | ||
</reportSet> | ||
</reportSets> | ||
</plugin> | ||
--> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>license-maven-plugin</artifactId> | ||
<version>1.16</version> | ||
<reportSets> | ||
<reportSet> | ||
<reports> | ||
<report>aggregate-third-party-report</report> | ||
</reports> | ||
</reportSet> | ||
</reportSets> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
|
||
</project> |
95 changes: 95 additions & 0 deletions
95
src/main/java/com/regnosys/rosetta/common/inspect/PathType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package com.regnosys.rosetta.common.inspect; | ||
|
||
import java.lang.reflect.Method; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.stream.Collectors; | ||
|
||
import static com.regnosys.rosetta.common.inspect.RosettaReflectionsUtil.getReturnType; | ||
|
||
public class PathType { | ||
|
||
public static PathType root(Class<?> type) { | ||
return new PathType(type.getSimpleName(), type); | ||
} | ||
|
||
private final LinkedList<Element> elements; | ||
|
||
private PathType(String accessor, Class<?> type) { | ||
LinkedList<Element> newElements = new LinkedList<>(); | ||
newElements.add(new Element(accessor, type)); | ||
this.elements = newElements; | ||
|
||
} | ||
|
||
public PathType(PathType parent, Method method) { | ||
LinkedList<Element> newElements = new LinkedList<>(); | ||
newElements.addAll(parent.elements); | ||
newElements.add(new Element(attrName(method), getReturnType(method))); | ||
this.elements = newElements; | ||
|
||
} | ||
|
||
public List<String> getPath() { | ||
return elements.stream().map(Element::getAccessor).collect(Collectors.toList()); | ||
} | ||
|
||
public List<Class<?>> getPathTypes() { | ||
return elements.stream().map(Element::getType).collect(Collectors.toList()); | ||
} | ||
|
||
public Class<?> getType() { | ||
return elements.getLast().getType(); | ||
} | ||
|
||
private String attrName(Method method) { | ||
String attrName = method.getName().replace("get", ""); | ||
return Character.toLowerCase(attrName.charAt(0)) + attrName.substring(1); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.join(" -> ", getPath()); | ||
} | ||
|
||
private static class Element { | ||
private final String accessor; | ||
private final Class<?> type; | ||
|
||
public Element(String accessor, Class<?> type) { | ||
this.accessor = accessor; | ||
this.type = type; | ||
} | ||
|
||
public String getAccessor() { | ||
return accessor; | ||
} | ||
|
||
public Class<?> getType() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Element element = (Element) o; | ||
return Objects.equals(accessor, element.accessor) && | ||
Objects.equals(type, element.type); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(accessor, type); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Element{" + | ||
"accessor='" + accessor + '\'' + | ||
", type=" + type + | ||
'}'; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/regnosys/rosetta/common/inspect/PathTypeNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.regnosys.rosetta.common.inspect; | ||
|
||
import com.rosetta.model.lib.RosettaModelObject; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
import static com.regnosys.rosetta.common.inspect.RosettaReflectionsUtil.getAllPublicNoArgGetters; | ||
import static com.regnosys.rosetta.common.inspect.RosettaNodeInspector.Node; | ||
|
||
public class PathTypeNode implements Node<PathType> { | ||
|
||
private final PathType pathType; | ||
|
||
public PathTypeNode(PathType pathType) { | ||
this.pathType = pathType; | ||
} | ||
|
||
@Override | ||
public List<Node<PathType>> getChildren() { | ||
return getAllPublicNoArgGetters(pathType.getType()).stream() | ||
.map(method -> new PathType(pathType, method)) | ||
.map(PathTypeNode::new) | ||
.collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public PathType get() { | ||
return pathType; | ||
} | ||
|
||
@Override | ||
public boolean visited(Node<PathType> childNode) { | ||
return pathType.getPathTypes().contains(childNode.get().getType()); | ||
} | ||
|
||
@Override | ||
public boolean inspect() { | ||
return RosettaModelObject.class.isAssignableFrom(this.pathType.getType()); | ||
} | ||
} |
Oops, something went wrong.