I am trying to get value from properties for removeOnFailure as below: but can't
tried with ${} and {{}}} nothing works.
<idempotentConsumer messageIdRepositoryRef="infinispanRepo" removeOnFailure="{{infinispan.hotrod.client.removeOnFailure}}">
Application.properties
infinispan.hotrod.client.removeOnFailure=false
Related
I am trying to add the new column and row/content to the existing CSV data but unable to achieve this in Apache Camel
I have used camel-csv component in the code and below is the snippet for the same.
<unmarshal>
<csv delimiter="|" useMaps="true" lazyLoad="true" />
</unmarshal>
When unmarshalling, getting "org.apache.camel.dataformat.csv.CsvUnmarshaller$CsvIterator" as class name but unable to get the exchange or cast to any type to this class as this is abstract class.
Let me know if we can use bean component and solution to add the column and content to the existing CSV data.
I can suggest an alternative solution. You can use BeanIO Data Format.
E.g :
BeanIODataFormat dataFormat = new BeanIODataFormat("classpath:beanio/mappings.xml", "ContactsCSV");
from("direct:convert-to-csv")
.marshal(dataFormat)
.to("file:xxxx")
.end();
You can find check data format details in docs. There is an examples file in there as well.
I have a problem reading different fileName from Camel file component.
from("file:/in?fileName={{property.name}}")
.to(file:/out)
I used fileName={{property.name}} from application.yml, but I need to use it from String.
Is there any way to use it like:
String name = "blabla.xml";
from("file:/in?fileName=${name}")
.to(file:/out)
Camel don't support it. String concatenation can solve your problem:
from("file:/in?fileName="+name)
or you can set a property and then read it:
String name="name";
from("direct:start")
.setProperty("name",constant(name))
.to("file:/in?fileName=${exchangeProperty.name}");
Currently have the following configuration and the application works as expected:
#CrossOrigin(origins = { "https://localhost:5000","http://localhost:5000"})
would like to change to something that can be configured in a properties file for different environments. I Can get to work with one Value but can't figure out a way for it to work with more than one. When a properties file is application-dev.properites has:
cors.client.urls=http://localhost:5000,https://localhost:5000
The appropriates values are not loaded with the following declaration:
#CrossOrigin(origins = {"${cors.client.urls}"})
When the properties file is just one value this declaration works as expected.
I know that I am missing something extremely basic.. Appreciate any help.
You can use SpringEL here as mentioned in Reading a List from properties file and load with spring annotation #Value
#CrossOrigin(origins = {#{'${cors.client.urls}'.split(',')}})
I am automating a salesforce application using Selenium TestNG. I am implementing a utility using apache PDFBox where i paste all my screenshots into a PDF to make client happy .
My logic is i create screenshots in each method with 1.png , 2.png etc until n.png and paste them in pdf using pdfbox methods.
The problem is my number of screenshots are variable so i implemented iTestContext where i set a variable counter to maximum number pass them to my after method where i retrieve the counter , and those number of screenshots are pasted- something like this
Class Login {
#Test
mymethod(ItestContext context){
commonfunctions.savescreenshot(1.png);
commonfunctions.savescreenshot(2.png);
commonfunctions.savescreenshot(n.png);
context.setAttribute("Counter", "n");
}
#AfterMethod
myaftermethod(){
String PATH = //Path of my test method
String MethodCounter = (String)context.getAttribute("Counter");
PDFUtility.addImagetoPDF(PATH,Integer.parseInt(MethodCounter) );
}
}
The problem is i have many methods that i need to implement and i dont want ITestContext listener as argument to each method.Can i pass it in xml file and use it for all methods?
Hope i have provided all details
If you need to get hold of the current ITestContext object (which is a representation of the current <test> tag being executed), you don't need to pass it as a parameter to your #Test method.
You can get access to it from within a #Test annotated test method via something like this:
org.testng.ITestContext context =
org.testng.Reporter.getCurrentTestResult().getTestContext();
This way you dont need to pass the org.testng.ITestContext object as a parameter to your #Test method.
Can i pass it in xml file and use it for all methods?
No you cannot pass the ITestContext object via the xml file.
I'm using ibatis + DWR , but when i pass a map to ibatis i will get an error as below:
Cause: com.ibatis.sqlmap.client.SqlMapException: ParameterObject or
property was not a Collection, Array or Iterator.
here is my sql:
<update id="updateDarenFlagByUserTagIDs" parameterClass="java.util.Map">
update system_usertag
set isdaren = 1
where uid = #uid#
<isNotEmpty prepend=" AND " property="utidlist">
and utid in
<iterate open="(" close=")" conjunction="," property="utidlist">
#utidlist[]#
</iterate>
</isNotEmpty>
</update>
and here in the DWR part, i passed a map as below:
{'uid':uid, 'utidlist':utidlist}
Any ideas on this error?
I have answered the exact same question in the following post https://stackoverflow.com/questions/18997883/malformed-url-exception-in-ibatis/19025819#19025819 do make reference to it. The solution to your problem is very simple, ensure that the argument nested in your iterate tag <iterate></iterate> which in your case is "utidlist" is indeed a list/collection and nothing but a list. The cause of this error is that your iterable property "utidlist" isn't a list. If you can get it to be a list and not a flat value you'll just be fine.
Just in case you can still get it to work you may also want to paste a full stack of your logs so that you can see what is going wrong.