How I can use variables in Adobe OSGI DDX Assembler like we are used in Livecycle ES4 DDX - osgi

We used workflow variables in DDX assembler with Livecycle ES4 JEE.
Like this:
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result = "myPDF">
<Watermark scale="70%" verticalOffset="-85pt" opacity="100%">
<PDF source = "docLoteDeclaracoes" pages="{$/process_data/#intPagina$}"/>
</Watermark>
<PDF source = "docModeloAnexo"/>
</PDF>
<?ddx-source-hint name = "docLoteDeclaracoes"?>
<?ddx-source-hint name = "docModeloAnexo"?>
</DDX>
In this code workflow process put value of page to be extracted from "docLoteDeclaracoes" in variable intPaginas.
I need to do similar thing using AEM Forms OSGI workflow, but this form to reference variables don't working.
Any one know how reference OSGI workflow variables in DDX document?
I am using AEM Forms 6.5

This is other solution for this case.
Create one file with DDX commands.
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result = "doc.pdf">
<PDF source = "docLoteDeclaracoes" pages="1"/>
</PDF>
<?ddx-source-hint name = "docLoteDeclaracoes"?>
</DDX>
Set one process variable type XML with file content.
Update command XML Node with xpath for the content.
XPath: //PDF[#source="docLoteDeclaracoes"]/#pages
Invoke DDX

Related

Jmeter - how to write specific variable to CSV file to specific row/column

My csv file looks like:
TC_name, username, password, excpecedCode
ad_test_master_successful_login,username,Test123!,200
What is the easiest way to so i can write to csv to specific row/column, and example to overwrite Test123! with variable fetched from user defined variables?
I know i can read value using JSR223 Pre/post processor with ex:
def line10 = new File('C:/Users/test/Desktop/testData/login.csv').readLines().get(1).split(",")[2]
log.warn("csv as-> " + line10);
There is no such concept as "cell" in CSV files, if you're looking for the code which will replace one string with another, you can do something like:
def file = new File('test.csv')
def text = file.text.replaceAll('Test123!', vars.get('foo'))
file.text = text
If you're looking for a better option you can consider using GroovyCSV library (you will need to download it and place in JMeter Classpath followed by JMeter restart) or consider switching to Excel file where you will have full control via Apache POI library like it's described in How to Implement Data Driven Testing in your JMeter Test article

How to rename the title of the HTML Report generated by pytest-html plug in?

I am generating html report using pytest-html plugin. I'm executing the pytest file by giving "pytest --html=report.html" in command line.
So the name and title of the html report generated is report.html. I want to change the title of the generated report.
Please let me know, how to do that?
Since v2.1.0, this plugin exposes a hook called before adding the title to the report. You can add this to conftest.py:
def pytest_html_report_title(report):
report.title = 'your title!'
This is also explained in the plugin's User Guide.
create conftest.py file in the same folder of the test.
this file is used to configure pytest.
put this snippet inside
def pytest_html_results_summary(prefix, summary, postfix):
prefix.extend([html.h1("A GOOD TITLE")])
if you need to change the html report file name you can try something like this
# #pytest.hookimpl(tryfirst=True)
def pytest_configure(config):
# to remove environment section
config._metadata = None
if not os.path.exists('reports'):
os.makedirs('reports')
config.option.htmlpath = 'reports/' + datetime.now().strftime("%d-%m-%Y %H-%M-%S") + ".html"
my example will put the report.html file in a folder called reports naming with a date instead of a static name
From what I see in the code there is no mean to change only the report's title yet, it is for now hardcoded as
html.h1(os.path.basename(self.logfile))
So the report title will always be the report file name. I've just pushed a merge request to the project to add a new hook to allow the change of the title without changing the file name, we will see if it is accepted.

How do I get Lazybones to create Multi Modular Java EE 7 Gradle Projects?

This is my repository in github: https://github.com/joedayz/lazybones-templates/
I used processTemplates according with the documentation
processTemplates 'build.gradle', props
processTemplates 'gradle.properties', props
processTemplates 'src/main/java/*.java', props
processTemplates 'settings.gradle', props
I request the user this information:
props.project_megaproceso = ask("Define value for 'megaproceso' [megaproceso]: ", "megaproceso", "megaproceso")
props.project_macroproceso = ask("Define value for 'macroproceso' [macroproceso]: ", "macroproceso", "macroproceso")
props.project_proceso = ask("Define value for 'proceso' [proceso]: ", "proceso", "proceso")
megaproceso2, macroproceso, proceso are directories or part of file names in my template.
How do I change the names of the unpacked directories and files? The code is in my github.
The post-install scripts for Lazybones currently have full access to both the standard JDK classes and the Apache Commons IO library, specifically to aid with file manipulation.
In this specific case, you can either use File.renameTo() or FileUtils.moveFile/Directory(). For example:
def prevPath = new File(projectDir, "megaproceso2-macroproceso-proceso.ear")
prevPath.renameTo(new File(
projectDir,
"${props.megaproceso}-${props.macroproceso}-${props.processo}.ear"))
The projectDir variable is one of several properties injected into the post-install script. You can find a list of them in the Template Developers Guide.
I think the main advantage of FileUtils.moveFile() is that it works even if you're moving files across devices, but that's not necessary here. Also note that you have to explicitly import the classes from Commons IO if you want to use them.

Ruby Builder Gem - dynamically set node name

I'm currently using the Builder gem for Ruby to generate XML representations for resources in my application. The XML representation has multiple child nodes that are always structure the same, but the top-level node has a different name, depending on the value of a boolean property of the resource. Is there any way I can generate builder nodes dynamically? Something like this (tried this already, doesn't work):
if resource.attr
top_level_node = :ForFlowBased
else
top_level_node = :ForNonSeamlessOffload
end
builder = Builder::XmlMarkup.new
builder.send(top_level_node). do |top_level_node|
....
end
That code will generate a node <send:ForFlowBased>. Similarly if I call builder.(top_level_node), the xml generated is <call:ForFlowBased>. I'm looking to dynamically send builder the method I want to invoke on it, without adding send or call to the XML as well.
Do this:
builder.tag!(top_level_node) do |top_level_node|
end

BIRT: Specifying XML Datasource file as parameter does not work

Using BIRT designer 3.7.1, it's easy enough to define a report for an XML file data source; however, the input file name is written into the .rptdesign file as constant value, initially. Nice for the start, but useless in real life. What I want is start the BIRT ReportEngine via the genReport.bat script, specifying the name of the XML data source file as parameter. That should be trivial, but it is surprisingly difficult...
What I found out is this: Instead of defining the XML data source file as a constant in the report definition you can use params["datasource"].value, which will be replaced by the parameter value at runtime. Also, in BIRT Designer you can define the Report Parameter (datasource) and give it a default value, say "file://d:/sample.xml".
Yet, it doesn't work. This is the result of my Preview attempt in Designer:
Cannot open the connection for the driver: org.eclipse.datatools.enablement.oda.xml.
org.eclipse.datatools.connectivity.oda.OdaException: The xml source file cannot be found or the URL is malformed.
ReportEngine, started with 'genReport.bat -p "datasource=file://d:/sample.xml" xx.rptdesign' says nearly the same.
Of course, I have made sure that the XML file exists, and tried different spellings of the file URL. So, what's wrong?
What I found out is this: Instead of defining the XML data source file as a constant in the report definition you can use params["datasource"].value, which will be replaced by the parameter value at runtime.
No, it won't - at least, if you specify the value of &XML Data Source File as params["datasource"].value (instead of a valid XML file path) at design time then you will get an error when attempting to run the report. This is because it is trying to use the literal string params["datasource"].value for the file path, rather than the value of params["datasource"].value.
Instead, you need to use an event handler script - specifically, a beforeOpen script.
To do this:
Left-click on your data source in the Data Explorer.
In the main Report Design pane, click on the Script tab (instead of the Layout tab). A blank beforeOpen script should be visible.
Copy and paste the following code into the script:
this.setExtensionProperty("FILELIST", params["datasource"].value);
If you now run the report, you should find that the value of the parameter datasource is used for the XML file location.
You can find out more about parameter-driven XML data sources on BIRT Exchange.
Since this is an old thread but still usefull, i ll add some info :
In the edit datasource, add some url to have sample data to create your dataset
Create your dataset
Then remove url as shown
add some script

Resources