Skip to content

Commit

Permalink
Fix formalize attributes config name and line-endings issue + setup g…
Browse files Browse the repository at this point in the history
…ithub workflow (#1)

* Fixed naming error from formalizeExtendedAtrributes to  formalizeExtendedAttributes.

* Refactored PowerDeComposerTest into PowerDeComposer maven project.
Updated pom to include needed dependencies, updated scm paths, updated executable jar creation to be in line with XG.

* Added github workflows.

* Updated pom schemagen settings.
Updated xsd using schemagen.
Updated gitignore.
Removed azure pipeline and generate jar scripts.

* Removed episode file.

* Updated logging properties so everything is not logged twice.

* Added unit tests for new line handing in compose phase.
Refactired Steps a bit to support prepared test files (separate from runtime).

* Created gitattributes file for test files (to make sure CR and CRLF are captured in Git as created).

* Updated line enddings in Git after gitattributes setting.

* Added matrix in job to run on windows and linux.

* Removed vscode settings.

* Disabled fail-fast in workflow job.

* Added os and java version to test result name.
Add condition for publishing jar only in linux run.

* Refactored logging to use global logger and setup INFO for normal use and FINE for testing.

* Updated spaces/tabs in feature file.
Removed unneeded semi-colon.

* Changed all feature files from LF to CRLF.
Added closing streams when writing file.

* Updated Steps to always have CRLF for inline Cucumber content (and not otherwise).

* Added java version to jar artifact.
Added jdk 17 to matrix.

* Added tests (with steps) to verify new-line handling on Decompose process.

* Refactored getVTDNav function in XmlUtils to work in byte[] so we can pass the byte[] of an XML fargment, i.s.o. the string.
Changed decomposer to get the byte[] of the decompose file parts to solve the line-ending issue.
  • Loading branch information
harmen-xb authored Mar 1, 2024
1 parent 2ad31b0 commit de88a7e
Show file tree
Hide file tree
Showing 63 changed files with 2,115 additions and 1,857 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
on:
workflow_call:

env:
MAVEN_VERSION: 3.8.6

defaults:
run:
shell: bash

jobs:
build-and-test:
strategy:
# Don't fail other run's if one fails. Let them all finish.
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
java: [11, 17]

name: Build and test
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
# Checkout the code
- name: checkout
uses: actions/checkout@v4

# Setup Java
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '${{ matrix.java }}'
distribution: 'temurin'
architecture: x64
cache: 'maven'

# Build with Maven
- name: Build
run: mvn --batch-mode install -DskipTests
working-directory: ./PowerDeComposer

# Test with Maven
- name: Run Unit Tests
run: mvn --batch-mode test -Dtest="RunPDCUnitTest"
working-directory: ./PowerDeComposer

- name: Test Report
uses: phoenix-actions/test-reporting@v12
id: test-report # Set ID reference for step
if: success() || failure() # run this step even if previous step failed
with:
name: test-results-${{ matrix.os }}-java-${{ matrix.java }}
path: PowerDeComposer/target/surefire-reports/TEST-*.xml
reporter: java-junit

# Build single jar
- name: Assemble Jar
if: runner.os == 'Linux'
run: mvn --batch-mode assembly:single -DskipTests
working-directory: ./PowerDeComposer

# Publish jars.
- uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: jar-without-dependencies-java-${{ matrix.java }}
path: PowerDeComposer/target/PowerDeComposer-*[0-9].jar
compression-level: 0 # no compression, since jar is already compressed
- uses: actions/upload-artifact@v4
if: runner.os == 'Linux'
with:
name: jar-with-dependencies-java-${{ matrix.java }}
path: PowerDeComposer/target/PowerDeComposer-*[0-9]-jar-with-dependencies.jar
compression-level: 0 # no compression, since jar is already compressed
13 changes: 13 additions & 0 deletions .github/workflows/cicd-feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: cicd-feature

on:
push:
branches:
- feature/*
pull_request:
branches:
- feature/*

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
10 changes: 10 additions & 0 deletions .github/workflows/cicd-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: cicd-main

on:
push:
branches:
- main

jobs:
build-and-test:
uses: ./.github/workflows/build-and-test.yml
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ target
/bin/
/target/
**/*.xjb
PowerDeComposer/src/main/resources/com/xbreeze/xml/config/schema1.xsd
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions Documentation/docs/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The PowerDeComposer configuration for composing and decomposing model files.
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PowerDeComposerConfig>
<Decompose fileRemovalStrategy="..." formalizeExtendedAtrributes="...">
<Decompose fileRemovalStrategy="..." formalizeExtendedAttributes="...">

<!-- Specify a XPath to execute on both sides (composed and decomposed) to decide whether the decompose. -->
<!-- The value of the XPath must be found in the root XML document of the decomposed model, so it can be in a decompose part of the model. -->
Expand Down Expand Up @@ -84,7 +84,7 @@ The PowerDeComposer configuration for composing and decomposing model files.
| Config element | Description |
|:--- |:--- |
| fileRemovalStrategy | Specify a file removal strategy that is used to remove previously decomposed files. "includes" will traverse the includes tree of the decomposed files and build the list based on them. This is also the default value that is used if not specified. "files" will traverse the decomposed directory and build the list based on the files that are present. |
| formalizeExtendedAtrributes | Indicate whether extended attributes should be formalized during de-composing of PowerDesigner models. Extended attributes are stored as a piece of text, while formalizing this text is translated into XML elements which can more easily be accessed using XPath (for example when using CrossGenerate). When this attribute is not specified in the config, the value will be "true". Possible values are "true" and "false". |
| formalizeExtendedAttributes | Indicate whether extended attributes should be formalized during de-composing of PowerDesigner models. Extended attributes are stored as a piece of text, while formalizing this text is translated into XML elements which can more easily be accessed using XPath (for example when using CrossGenerate). When this attribute is not specified in the config, the value will be "true". Possible values are "true" and "false". |
| ChangeDetection | Node to evaluate on the composed and decomposed models. Of the value is empty on at least one side or the value differs the decompose is executed. |
| IdentifierReplacement | Instruction to replace identifiers with alternative values. The identifierNodeXPath is the node which contains the identifier in the composed model. The replacementValueXPath must be executed to get the new identifier value. The referencingNodeXPath value is optional, it if specified the value in these nodes will also be replaced using the value of the old identifier and the new identifier. |
| NodeRemoval | Instruction to remove nodes before decomposing. The XPath is evaluated to find the nodes to remove. An example for such an instruction is to remove the modification date on referenced objects. |
Expand Down
16 changes: 6 additions & 10 deletions PowerDeComposer/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,21 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="test" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
Loading

0 comments on commit de88a7e

Please sign in to comment.