Migrate Companion for Delivery version from 2.1.2 to 3.0.0
File inclusion
New syntax
In order to reduce compilation times, Companion for Delivery 3.0.0 now uses a new syntax for file inclusion.
The path of the file is now inside the call to the @file()
extension, and is the absolute path from the step
directory.
For example, with this structure :
.
├─── step-integration/
│ ├─── src/
│ │ ├─── main/step/
│ │ │ ├─── example_directory/
│ │ │ │ ├─── companion/
│ │ │ │ │ └─── example.companion.xml
│ │ │ │ └─── example.xml
│ │ └─── test/
│ └─── pom.xml
└─── pom.xml
Whenever you want to include a file example.xml
to your example.companion.xml
, you write :
2.1.2
@import example_directory._
@xml.example()
3.0.0
@file("example_directory/example.xml")
Escaping XML
You will still be able to escape XML specific characters (<
, >
, "
, and '
) with the @escapeXml()
extension. However @file()
comes with an optional parameter, a boolean indicating if the file must be escaped before being imported. By default, the XML content of the file is not escaped, but if you want to import Javascript or collections into your file, you must use this parameter to escape XML characters :
@file("path/example.js", true)
Decompiler
The decompiler has been updated to use this new syntax. You can use it to migrate your files, however the structure of the newly generated project may not correspond to your previous structure. If you want to do so, you will have to compile your project with Companion for Delivery 2.1.2, then decompile the obtained file with Companion for Delivery 3.0.0.
Unit Test
In 3.0.0 we automatically added business rule dependencies to unit test business rule and cleaned useless annotation for unit test.
BusinessRule
annotation need to be migrated:
- Replace
js
field byxml
field containing path to.companion.xml
file
@BusinessRules({
@BusinessRule(id="BA0040", js = "/com/step/companion/Dummy.js", alias="executeDummyActionOrCondition", bindings = {"firstParam", "secondParam"})
})
is now
@BusinessRules({
@BusinessRule(id="BA0040", xml = "/com/step/companion/Dummy.companion.xml", alias="executeDummyActionOrCondition", bindings = {"firstParam", "secondParam"})
})
These annotations need to be removed in your tests:
BusinessRuleBinding
Dependency
ExecutionPlatform
These fields on annotations has been removed too:
jssDir
,jss
anddependencies
onBusinessLibrary
depencencies
onBusinessRule
jss
anddependencies
onJSTestFile
You can also remove this maven plugin that is no longer needed :
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>pre-integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/step</directory>
<includes>
<include>**/*.js</include>
</includes>
</resource>
</resources>
<overwrite>true</overwrite>
</configuration>
</execution>
</executions>
</plugin>