Visual Studio truncates message in Test Detail Summary window - visual-studio

I have test which compares two json objects. If test fails then I print those json objects.
Assert.That(
json1,
Is.EqualTo( json2 ).Using<JToken>( JToken.DeepEquals ),
"Jsons are not equal\n{0}\n{1}", json1.ToString(), json2.ToString() );
But Visual Studio truncates my message :( Message from TestContext.Out is also truncated.
How can I increase message length limit?

I have temporarily solved this problem by saving the test's result to an xml file.
To achieve it you should create .runsettings file.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<ResultsDirectory>ResultsDirectory</ResultsDirectory>
</RunConfiguration>
<NUnit>
<TestDirectory>TestDirectory</TestDirectory>
<WorkDirectory>WorkDirectory</WorkDirectory>
<TestOutputXml>TestOutputXml</TestOutputXml>
<InternalTraceLevel>Info</InternalTraceLevel>
</NUnit>
</RunSettings>

Related

Problem loading sld raster style in Geoserver 2.15.1

When I try to load mi sld style to a hillshade raster (tif format) it gives me the folllowing message:
line 21: cvc-complex-type.2.1:the element 'sld: normalize' must not have any characters or any [child] element information elements, because the type content type is empty.
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xmlns:sld="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc">
<UserLayer>
<sld:LayerFeatureConstraints>
<sld:FeatureTypeConstraint/>
</sld:LayerFeatureConstraints>
<sld:UserStyle>
<sld:Name>hill_22</sld:Name>
<sld:FeatureTypeStyle>
<sld:Rule>
<sld:RasterSymbolizer>
<sld:Opacity>0.2</sld:Opacity>
<sld:ChannelSelection>
<sld:GrayChannel>
<sld:SourceChannelName>1</sld:SourceChannelName>
<sld:ContrastEnhancement>
<sld:Normalize>
<sld:VendorOption name="algorithm">StretchToMinimumMaximum</sld:VendorOption>
<sld:VendorOption name="minValue">1</sld:VendorOption>
<sld:VendorOption name="maxValue">181</sld:VendorOption>
</sld:Normalize>
</sld:ContrastEnhancement>
</sld:GrayChannel>
</sld:ChannelSelection>
<sld:ColorMap>
<sld:ColorMapEntry quantity="0" color="#000000"/>
<sld:ColorMapEntry quantity="255" color="#ffffff"/>
</sld:ColorMap>
</sld:RasterSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</UserLayer>
</StyledLayerDescriptor>
This is caused because the GeoServer validator uses the OGC schema to validate the SLD, while specifying optional VendorOptions is not part of the standard. So as you know better than the computer you can ignore it and press apply and all will be fine.
If it really bothers you, you can submit a PR to update the schema used to accept this change.

Update parameter value in XML format

I have parameters stored in an XML file. Below is a sample of the file.
<?xml version="1.0" encoding="UTF-8"?>
<root>
<terminal id="A">
<terminalCapacity>3</terminalCapacity>
<terminalMembers id="1">
<memberID>0001</memberID>
<memberCapacity>2</memberCapacity>
</terminalMembers>
</terminal>
<terminal id="B">
<terminalCapacity>4</terminalCapacity>
<terminalMembers id="1">
<memberID>0002</memberID>
<memberCapacity>1</memberCapacity>
</terminalMembers>
<terminalMembers id="2">
<memberID>0003</memberID>
<memberCapacity>3</memberCapacity>
</terminalMembers>
</terminal>
</root>
Each terminalID is associated to a type of simpleModule found in my NED file. The idea is to programmatically update these values throughout the simulation run. The current logic revolves around getting the current parameters in XML format and update the memberCapacity field.
From the Omnet cPar and cXMLElement documentation, I tried using the par("moduleParameter").xmlValue()->getXML() function, but this returns the XML as a string. I also tried using the getAttribute() function, but to no success.
Don't do this. par("moduleParameter").xmlValue() will give you the in memory object tree of the XML document, but that is not meant for modification. Your XML file seems to be just a hierarchical structure and modules and their parameters can mirror that exactly. There is absolutely no reason to reinvent the wheel when you can mirror that with INI file parameters.

Excelize freeze rows generates a file with errors

I am trying to freeze the top row and the first two columns of the sheet.
xlsx.SetPanes(sheetName, `{"freeze":true,"x_split":2,"y_split":1,"top_left_cell":"A1","active_pane":"topLeft","panes":[{"sqref":"A1:B1","pane":"topLeft"},{"sqref":"C1:XFD1", "pane":"topRight"},{"sqref":"A2:B2", "pane":"bottomLeft"},{"sqref":"C3:XFD3", "pane":"bottomRight"}]}`)
If I open the file in excel I get the below alert and after I try to recover the recovery log shows nothing removed:
Alert:
We found a problem with some content in ’test.xlsx’. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes.
Recovery log:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>Repair Result to test3.xml</logFileName>
<summary>Errors were detected in file ’/test.xlsx’</summary>
<repairedRecords summary="Following is a list of repairs:">
<repairedRecord>Repaired Records: View from /xl/worksheets/sheet1.xml part</repairedRecord>
</repairedRecords>
</recoveryLog>
This is not a problem with the data as the file works fine if I remove the setPanes method. What am I doing wrong?
Also note that if I open the file with google sheets its working fine.
I figured it out in the end
xlsx.SetPanes(sheetName, `{"freeze":true,"x_split":2,"y_split":1,"top_left_cell":"C2","active_pane":"bottomRight","panes":[{"pane":"topLeft"},{"pane":"topRight"},{"pane":"bottomLeft"},{"active_cell":"C2", "sqref":"C2", "pane":"bottomRight"}]}`)
Here is another Example. Setting Freeze in the first column and the first three rows:
xlsx.SetPanes(sheet, `
{
"freeze":true,
"x_split":1,
"y_split":3,
"top_left_cell":"B4",
"active_pane":"bottomRight",
"panes":[
{"pane":"topLeft"},
{"pane":"topRight"},
{"pane":"bottomLeft"},
{"active_cell":"B4", "sqref":"B4", "pane":"bottomRight"}
]
}
`)
The key seems to determine what is your x_split,y_split value and sqref location. A bit of struggle but props to the author for figuring out.

IBM Integeration BUS: Trace Node

In simple message flow in which there are 3 nodes. One is MQ input node which is receiving an xml input. Other is MQ Output node which is receiving msg passed from MQ input. In between there is trace node. The trace node is configured to generate trace in a file. it trace down the whole xml msg, its content in the file. What if I want to track a single tag of xml file like contact number.
i.e:
<contactDetails>
<contactName>Acme</contactName>
<contactNumber>09200209</contactNumber>
</contactDetails>
Which pattern should I use? I have tried ${Body.contactDetails.contactNumber} and ${Environment.contactDetails.contactNumber} but I am getting null in output. Can anyone help?
EDIT: Below is the whole message:
<?xml version="1.0" encoding="utf-8"?>
<tns:In_Request xmlns:tns="http://www.ibm.lab.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ActionRequest>O</ActionRequest>
<DateRequest>10/12/2005</DateRequest>
<customerNumber>1</customerNumber>
<customerName>ACME Hardware</customerName>
<customerDetails>
<customerAddress1>1254 Main St</customerAddress1>
<customerAddress2>Suite 12</customerAddress2>
<customerCity>Dime Box</customerCity>
<customerState>TX</customerState>
<customerCountry>USA</customerCountry>
<customerPostalCode>76543</customerPostalCode>
<customerCreditLimit>1200</customerCreditLimit>
<customerCreditScore>123</customerCreditScore>
</customerDetails>
<contactDetails>
<contactFirstName>Freddy</contactFirstName>
<contactLastName>Bloggs</contactLastName>
<contactPhoneNumber>555-123-6543</contactPhoneNumber>
</contactDetails>
<requestDecision>Y</requestDecision>
<comments>Just a Comment</comments>
</tns:In_Request>
I see the problem now.
Body in the reference points to the root element for the domain in which your message is parsed, e.g. to Root.XMLNSC if you set the message domain to XMLNSC on the input node of your message, so not to the root element of your message.
If you want to trace the value of the element contactPhoneNumber from the example message, you should use the following reference:
${Body.*:In_Request.contactDetails.contactPhoneNumber}
So after the Body, you must specify the whole path to your element. The *: part is needed because the root element in your message is in a namespace.

How to move property value from Properties file to payload object using spring integration elements

Sample.properties
=================
http.header.amisys.accept.value=arun/vnd.dsths.services-v1+xml
1)Above XSL automatically loaded when my server starts.
2)I have tried <int:enricher> element but it is not helped me.
Sample Code : Below is bit of code I have tried, Can any one suggest me on this.
<int:channel id="PQLegacySecurity-InputChannel" />
<int:chain input-channel="PQLegacySecurity-InputChannel" >
<!-- Split the Search Request Params from Xml -->
<int-xml:xpath-splitter>
<int-xml:xpath-expression expression="//LegacySecurity" namespace map="xmlMessageNamespace" />
</int-xml:xpath-splitter>
<int:enricher >
<int:payload name="testPayload" expression="${http.header.amisys.accept.value}"/>
</int:enricher>
</int:chain>
Actual Payload Object:Below is the xml which does not contain testPayload property.
<?xml version="1.0" encoding="UTF-8"?><LegacySecurity>
<businessArea>%%%%%%</businessArea>
<LegacySystem>%%%%%</LegacySystem>
<LegacyUserID>%%%%%</LegacyUserID>
<LegacyPassword>%%%%%</LegacyPassword>
<OtherLogin/>
<OtherPassword/>
<AddSecurLogin/>
<AddSecurPassword/>
</LegacySecurity>
Expected Payload Object: Below Object contains new element testPayload node which I should able to add
<?xml version="1.0" encoding="UTF-8"?><LegacySecurity>
<businessArea>%%%%%%</businessArea>
<LegacySystem>%%%%%</LegacySystem>
<LegacyUserID>%%%%%</LegacyUserID>
<LegacyPassword>%%%%%</LegacyPassword>
<OtherLogin/>
<OtherPassword/>
**<testPayload>arun/vnd.dsths.services-v1+xml</testPayload>**
<AddSecurLogin/>
<AddSecurPassword/>
</LegacySecurity>
You can use an xslt transformer. Something like the below, though you will need to figure out correct use of the transformer from the spring docs.
Notice you can pass a parameter through to the XSLT
<int-xml:xslt-transformer result-transformer="toDocumentTransformer" result-type="StringResult" xsl-resource="/xslt/addTestPayload.xslt">
<int-xml:xslt-param name="testPayload" value="${http.header.amisys.accept.value}"/>
</int-xml:xslt-transformer>
In the XSLT file, use this to pick up the parameter:
<xsl:param name="testPayload" />
If you have other changes you need to make to the message you can use the same xslt.

Resources