How To invoke a model's template from another model in xpand for AUTOSAR - xpand

I've been trying to develop an AUTOSAR 4.2.1 module to generate code using Xpand/Xtend. I'm using artext demonstrator 1.6.0. But my query is that the concept of defining a variation point is not found in the PDF(ECUConfigurationParameters.arxml) when I create a new Ecu platform project in the demonstrator (or maybe I'm not familiar with finding out how).
By default I'm able to fetch parameter values from an arxml. But when there is more than one value for a parameter which is defined in a different post build variant condition, I'm getting only the first value.
For example, if the arxml contains this
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF"> /AUTOSAR/EcucDefs/Com/ComConfig/ComIPdu/ComIPduCancellationSuppo rt</DEFINITION-REF>
<VARIATION-POINT>
<POST-BUILD-VARIANT-CONDITIONS>
<POST-BUILD-VARIANT-CONDITION>
<MATCHING-CRITERION-REF DEST="POST-BUILD-VARIANT-CRITERION">/EcucDemo/PostBuildConfigSet</MATCHING-CRITERION-REF>
<VALUE>1</VALUE>
</POST-BUILD-VARIANT-CONDITION>
</POST-BUILD-VARIANT-CONDITIONS>
</VARIATION-POINT>
<VALUE>1</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-BOOLEAN-PARAM-DEF"> /AUTOSAR/EcucDefs/Com/ComConfig/ComIPdu/ComIPduCancellationSuppo rt</DEFINITION-REF>
<VARIATION-POINT>
<POST-BUILD-VARIANT-CONDITIONS>
<POST-BUILD-VARIANT-CONDITION>
<MATCHING-CRITERION-REF DEST="POST-BUILD-VARIANT-CRITERION">/EcucDemo/PostBuildConfigSet</MATCHING-CRITERION-REF>
<VALUE>2</VALUE>
</POST-BUILD-VARIANT-CONDITION>
</POST-BUILD-VARIANT-CONDITIONS>
</VARIATION-POINT>
<VALUE>0</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
it gives me value as 'true' in Xpand if I do Com.ComConfig.ComIpdus.ComIPduCancellationSupport. I’m unable to access the second value ‘false’.
How may I proceed to fetch the parameter values based on the post-build variant conditions?
I'm trying to do the following:
«DEFINE Gen1 FOR varianthandling::VariationPoint»
«EXPAND Gen1::GetThings»
«ENDDEFINE»
«DEFINE GenMain FOR AUTOSAR::EcucDefs::Com»
«EXPAND Gen1 FOR varianthandling::VariationPoint»
«ENDDEFINE»
This gives me an error as 'Couldn't find definition ComOtherVarGen for type xpand2::Type'. How do I achieve the above?
Please note that I am not trying to add/modify any functionality to the template of 'MainObj' so 'AROUND' is not what I'm looking for.
Any help is greatly appreciated.

The tool which you are using to create the model (which is created from the PDF file + EcuC Values file) must be able to build a model which is post-build compatible.
If you are sure, this being done- Then try the below method
Com.ComConfig.ComIpdus.ComIPduCancellationSupport changes to
<FOREACH Com.ComConfig.ComIpdus.ComIPduCancellationSupport AS ele>
<ele>
<ENDFOREACH>
or
Com.ComConfig.ComIpdus.ComIPduCancellationSupport.get(0)
Com.ComConfig.ComIpdus.ComIPduCancellationSupport.get(1)

Related

Lpush and Zadd methods of Jedis not found in Jmeter

I have written a beanshell sampler which has the objective of setting the multiple values for a single key. I tried with lpush just for the start. Then I went on using the zadd method which I believe is for adding multiple values for a single key.
But, in both the cases, I am getting an error in the log viewer that the respective method in the jedis class does not exist. How do I go about resolving this error.
I have tried to replace the jedis jar file(current version i am using is: 2.2.1) with the latest version(in the lib folder) in order to ensure the completeness of the methods to be used. But then, while starting the jmeter from command line throws java.lang.VerifyError.
Please let me know the solution for this problem.
Show your code so that we can help more precisely.
Another option is to use this if you only want to read the values:
http://jmeter-plugins.org/wiki/RedisDataSet/

Invoke Method with client.soda ( Statement Object Model )

I am trying to build Esper EPL statements in Java.
I use the com.espertech.esper.client.soda lib for this, but I can't find
a tutorial to help me.
The PatternExpressions are the only part that I need as of now.
As an example let's use the EPL:
every a=Event((a).getEventTypeCode()='E00001')
So he should trigger on every Event with the event type code E00001, we get the code by
calling the getEventTypeCode Method.
How do I project this to SOM?
With:
PatternExpr pattern = Patterns.everyFilter("Event","a");
I only get:
every a=Event
(of course)
I know there is a class called "MethodInvocationStream" but I don't know how to use it.
And I cannot find examples for its use.
Thanks to user650839 I found out how to add Methods via SOM.
Here is a simple EPL as an SOM Object: http://imgur.com/SDrTsa7
One source of info is the javadoc.
You could simply do the reverse and compile EPL text to a model object and inspect that. Use "epAdmin.compileEPL", the output is the same object you want to build via API.\

Websphere JYTHON Scripting - Get Active Spec ID

Problem:
Attempting to use the JYTHON command below and I cannot retrieve the id of my active specification defined at a node-server level in Websphere. I believe its a syntax issue but I'm not sure what.
Code:
AdminConfig.getid('/Cell:mycell/Node:mynode/Server:myserver/J2CActivationSpec:myActiveSpecName/')
Problem Notes:
I do not get a invalid object error so I believe I have the syntax right but it just cannot find the resource even though it exists.
I am using the AdminConfig.getid() as a way to check if the resource already exists in order to do a modify or a create.
If I use the following code: AdminConfig.getid('/J2CActivationSpec:myActiveSpecName/') it will find it but not if I use a more specific path listed above.
Reference Material:
IBM Documentation
Containment paths are always a little tricky. In my (limited) experience, even if you can trace the path by AdminConfig.parents, you may not always be able to use getid.
Are you restricted to using getid? If not, here are some alternatives that will get you an ActivationSpec at the /Cell/Node/Server level:
Querying using AdminConfig.list
This approach will list the Activation Specifications at the specified scope (in our case, the server), and grab the one that has it's name attribute equal to 'myActiveSpecName'.
server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:myserver')
activationSpec = ''
for as in AdminConfig.list('J2CActivationSpec', server).splitlines():
if AdminConfig.showAttribute(as, 'name') == 'myActiveSpecName'
activationSpec = as
print 'found it :)'
Using Wildcards
This approah uses AdminConfig.list as well, but with a pattern to narrow down your list. If you know your activation spec's configuration begins with myActiveSpecName, then you can do the following:
activationSpec = AdminConfig.list('J2CActivationSpec', 'myActiveSpecName*')

Oracle Service Bus - Assign expression

I have this problem and I am not sure why it's happening and how to fix it. I have created an OSB peject. In the proxy service pipeline I am doing a Service Callout to a sync SOAP service in another application. The other service needs the request body as below:
<RequestSelectionValues xmlns="http://www.camstar.com/WebService/WSShopFloor">
<inputServiceData xmlns:q1="http://www.camstar.com/WebService/DataTypes" q1:type="OnlineQuery">
<OnlineQuerySetup>
<__CDOTypeName/>
<__name>xLot By FabLotNumber</__name>
</OnlineQuerySetup>
<Parameters>
<__listItem>
<Name>FabLotNumber</Name>
<DefaultValue>FAB_Lot_1</DefaultValue>
</__listItem>
<__listItem>
<Name>BLOCKOF200ROWS</Name>
<DefaultValue>1</DefaultValue>
</__listItem>
</Parameters>
</inputServiceData>
<queryOption xmlns:q2="http://www.camstar.com/WebService/DataTypes" q2:type="QueryOption">
<RowSetSize>1000</RowSetSize>
<StartRow>1</StartRow>
<QueryType>user</QueryType>
<ChangeCount>0</ChangeCount>
<RequestRecordCount>false</RequestRecordCount>
<RequestRecordSetAndCount>false</RequestRecordSetAndCount>
</queryOption>
<serviceInfo xmlns:q3="http://www.camstar.com/WebService/DataTypes" q3:type="OnlineQuery_Info">
<OnlineQuerySelection>
<RequestValue>false</RequestValue>
<RequestMetadata>false</RequestMetadata>
<RequestSubFieldValues>false</RequestSubFieldValues>
<RequestSelectionValues>true</RequestSelectionValues>
</OnlineQuerySelection>
</serviceInfo>
</RequestSelectionValues>
I am using an Assign to put the above expression in a variable.
Notice the line:
<serviceInfo xmlns:q3="http://www.camstar.com/WebService/DataTypes" q3:type="OnlineQuery_Info">
xmlns:q3="http://www.camstar.com/WebService/DataTypes" needs to be before q3:type="OnlineQuery_Info" for the other service to be called successfully otherwise the service call fails.
In the development it looks fine. I can test the assign of expression as well.
When I go to the OSB console to test the service I notice that in the Assign variable the namespace place switches and it becomes like this:
<serviceInfo q3:type="OnlineQuery_Info" xmlns:q3="http://www.camstar.com/WebService/DataTypes">
This makes the service calls to fail. I have tried putting the body payload in an xslt. Result is the same. I am not sure why it switches the type before namespace. The end result is that the service is not working as expected.
Any idea what I can do to fix this issue. How can I prevent the switching?
Thanks
I haven't found any settings in OSB that can prevent reordering of attributes for you. However, the above OSB behavior is completely XML standard compliant. In fact, the target service side should be XML compliant and treat the two variants mentioned above as the same, because according to XML standard, tow XML documents with only difference in attribute ordering should be treated as the same.
EDIT:
Please go here to download a modified config. My thoughts are:
Specify the business service to invoke in 'Text as Request' mode, as "CamstarLotQuery/business/CSWSShopFloor_Txt" shown below:
Manipulate messages as text, not XML, in your proxy service, as specified in "CamstarLotQuery/proxy/CamstarLotQueryTxt_Txt":
You might need to specify a SOAP Action in http header when calling a business service, depending on the target service.
One solution i can think of is to assign all the namespaces at the Parent Tag Level, and keep the attributes where they are applicable.
Example:
<RequestSelectionValues xmlns:q1="http://www.camstar.com/WebService/DataTypes" xmlns="http://www.camstar.com/WebService/WSShopFloor" xmlns:q2="http://www.camstar.com/WebService/DataTypes" xmlns:q3="http://www.camstar.com/WebService/DataTypes">
But the problem with this implementation is that since the namespace declaration is now Global, you have to declare your namespace prefixes (q1, q2, q3) to the blocks where the namespaces were previously defined.
Example:
<q3:serviceInfo q3:type="OnlineQuery_Info">
<q3:OnlineQuerySelection>
<q3:RequestValue>false</q3:RequestValue>
<q3:RequestMetadata>false</q3:RequestMetadata>
<q3:RequestSubFieldValues>false</q3:RequestSubFieldValues>
<q3:RequestSelectionValues>true</q3:RequestSelectionValues>
</q3:OnlineQuerySelection>
</q3:serviceInfo>
if this namespace prefix is not declared, then as per XML standards, the tag assume the 'default' namespace value - which will be the namespace of the parent.
However, even though this solution has a round-about way of implementation, this solution will definitely work.

ResourceManager.GetString() not returning value

I am trying to implement multiple language support for my web project. I am new to it.
I am not able to get the resource file value by using ResourceManager.GetString() function. I am passing the name and current CuluralInfo. The resource file present in my App_GlobalResources are Sample.resx, Sample.en-us.resx, Sample.zh-cn.resx and Sample.ar-sa.resx. I am having a name field named "Heading1" and its value in all the resource files
My code is like
string Heading1= Resources.Global.ResourceManager.GetString(("Heading1", Thread.CurrentThread.CurrentCulture);
But it is always returning null value. Please help me to get the solution for this problem
Thanks
San
I found the problem
The code should be like
string Heading1= Resources.Sample.ResourceManager.GetString(name, culture_object);

Resources