How to test Grails webflow with input parameter? - spring

I'm in the process of writing tests for webflows and I have a webflow (A) that calls another webflow (sub-webflow) (B) during its execution. If A calls B it always states a required parameter / input with the call. Testing A alone is not a problem but how can I test B on it's own? The input parameter is states as:
input {
station(required: true)
}
I tried starting with startFlow() but that gives me the following exception:
Failure: testCreateWizardSubSubFlow(com.lstelcom.spectraweb.data.EquipmentFlowTests)
org.springframework.webflow.engine.FlowInputMappingException:
Errors occurred during input mapping on startup of the 'createWizardSubSub' flow;
errors = [[RequiredError#51a9e7fc mapping = station -> station, code = 'required', error = true, errorCause = [null], originalValue = [null], mappedValue = [null]]]
at grails.test.WebFlowTestCase.startFlow(WebFlowTestCase.groovy:130)
at com.lstelcom.spectraweb.data.EquipmentFlowTests.testCreateWizardSubSubFlow(EquipmentFlowTests.groovy:38)
A method call of startFlow with an input parameter (e.g., startFlow(new Station()) ) does not exist in WebFlowTestCase as I get the error:
groovy.lang.MissingMethodException: No signature of method: com.lstelcom.spectraweb.data.EquipmentFlowTests.startFlow() is applicable for argument types: (com.lstelcom.spectraweb.data.stations.Station) values: []
Possible solutions: getFlow(), getFlow()
at com.lstelcom.spectraweb.data.EquipmentFlowTests.testCreateWizardSubSubFlow(EquipmentFlowTests.groovy:38)
So the question is how can I test a webflow with input parameter?

Related

Vulkan: validation layer: Validation Error: [ UNASSIGNED-GeneralParameterError-UnrecognizedValue ]

I am trying to program the "Graphic Hello World Program" in Vulkan which has the goal to draw a Triangle on the screen.
I am following this Tutorial.
I am getting two types of Errors.
The first Error is:
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_api_dump.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_device_simulation.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_gfxreconstruct.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_khronos_synchronization2.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_khronos_validation.json invalid layer manifest file version 1.2.0. May cause errors.
validation layer: loaderAddLayerProperties: C:\VulkanSDK\1.2.198.1\Bin\VkLayer_screenshot.json invalid layer manifest file version 1.2.0. May cause errors.
which I could find in a post on stackoverflow here
but I checked everything the solution is suggesting and the Error is still there.
The second Error is:
validation layer: Validation Error: [ UNASSIGNED-GeneralParameterError-UnrecognizedValue ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xbe6eff91 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].blendEnable (-858993460) is neither VK_TRUE nor VK_FALSE. Applications MUST not pass any other values than VK_TRUE or VK_FALSE into a Vulkan implementation where a VkBool32 is expected.
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xeb9e690 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].srcColorBlendFactor (-858993460) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: srcColorBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-srcColorBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x8db942fe | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].dstColorBlendFactor (-858993460) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: dstColorBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-dstColorBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x7978ef4f | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].colorBlendOp (-858993460) does not fall within the begin..end range of the core VkBlendOp enumeration tokens and is not an extension added token. The Vulkan spec states: colorBlendOp must be a valid VkBlendOp value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-colorBlendOp-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x4a7f8ed8 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].srcAlphaBlendFactor (-453845144) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: srcAlphaBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-srcAlphaBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x53ab1c8f | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].dstAlphaBlendFactor (569) does not fall within the begin..end range of the core VkBlendFactor enumeration tokens and is not an extension added token. The Vulkan spec states: dstAlphaBlendFactor must be a valid VkBlendFactor value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-dstAlphaBlendFactor-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x48f9f9b | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].alphaBlendOp (-1467165950) does not fall within the begin..end range of the core VkBlendOp enumeration tokens and is not an extension added token. The Vulkan spec states: alphaBlendOp must be a valid VkBlendOp value (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-alphaBlendOp-parameter)
validation layer: Validation Error: [ VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter ] Object 0: handle = 0x239e0488218, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb8f9c032 | vkCreateGraphicsPipelines: value of pCreateInfos[0].pColorBlendState->pAttachments[0].colorWriteMask contains flag bits that are not recognized members of VkColorComponentFlagBits The Vulkan spec states: colorWriteMask must be a valid combination of VkColorComponentFlagBits values (https://vulkan.lunarg.com/doc/view/1.2.198.1/windows/1.2-extensions/vkspec.html#VUID-VkPipelineColorBlendAttachmentState-colorWriteMask-parameter)
failed to submit draw command buffer!
I found a post on reddit which describes a similar problem here but the post isnt solved.
The failed to submit draw command buffer! message is thrown by a std::runtime_error caused by a false returnvalue of
vkQueueSubmit(device.graphicsQueue(), 1, &submitInfo, inFlightFences[currentFrame])
Some additional information which my program prints out between this two Error Messages:
available extensions:
VK_KHR_device_group_creation
VK_KHR_external_fence_capabilities
VK_KHR_external_memory_capabilities
VK_KHR_external_semaphore_capabilities
VK_KHR_get_physical_device_properties2
VK_KHR_get_surface_capabilities2
VK_KHR_surface
VK_KHR_surface_protected_capabilities
VK_KHR_win32_surface
VK_EXT_debug_report
VK_EXT_debug_utils
VK_EXT_swapchain_colorspace
VK_NV_external_memory_capabilities
required extensions:
VK_KHR_surface
VK_KHR_win32_surface
VK_EXT_debug_utils
Device count: 1
physical device: GeForce RTX 2060 SUPER
Present mode: Mailbox
I am using Windows 10.
First error(s) is normal if your driver's Loader is old. It should be benign. See "Known Issues" in the documentation.
The second error(s) seems to be caused by pCreateInfos[0].pColorBlendState->pAttachments[0] member not existing in your code or being uninitialized.
The third error is probably a result of the second error (failing to create or creating an invalid Pipeline).

Jmeter Construct Parameter Value based on DataSet

In JMeter, I want to construct the request parameter value from a dataset file based on the PropertyCount.
Dataset
PropertyCount propertyid1 propertyid2 propertyid3
2 13029526 15763743
3 13029526 15763743 12345645
2 13029526 15763743
Request Input Parameter
"values":["13029526","15763743"]
"values":[${outputString}]
PreProcessor Script
With the the below preprocessor script, I am getting the following output but looking to get the values as in Request Input Parameter, with quotes.
2021-08-29 22:15:04,706 INFO o.a.j.m.J.JSR223 PreProcessor: Required output: 13029526,15763743,
2021-08-29 22:15:04,785 INFO o.a.j.m.J.JSR223 PreProcessor: Required output: 13029526,15763743,
JSR223 PreProcessor
def requiredOutput = new StringBuilder()
1.upto(vars.get('propertycount') as int, {
requiredOutput.append(vars.get('propertyid' + it))
requiredOutput
requiredOutput.append(',')
vars.put("outputString",requiredOutput.toString());
})
You're seem to be constructing a JSON Array therefore it makes more sense to consider using Groovy's JsonBuilder instead of doing manual string concatenation:
def outputString = []
1.upto(vars.get('PropertyCount') as int, {
outputString.add(vars.get("propertyid$it"))
})
vars.put('outputString', new groovy.json.JsonBuilder(outputString).toPrettyString())
More information:
Apache Groovy - Parsing and producing JSON
Apache Groovy - Why and How You Should Use It

The "error_marshaling_enabled" setting seems to be always enabled

When I run this code:
$client->evaluate('
box.session.settings.error_marshaling_enabled = false
box.error{code = 42, reason = "Foobar", type = "MyError"}
');
regardless of the value of error_marshaling_enabled I always get a response with a new (extended) error format:
[
49 => 'Foobar',
82 => [
0 => [
0 => [
0 => 'CustomError',
2 => 3,
1 => 'eval',
3 => 'Foobar',
4 => 0,
5 => 42,
6 => [
'custom_type' => 'MyError',
],
],
],
],
],
Why is that?
Short answer.
error_marshaling_enabled option affects only how error objects are encoded in response body (48, IPROTO_DATA). It does not affect how they are returned as exceptions, in the response header (82, IPROTO_ERROR).
Long answer.
In Tarantool an error object can be returned in 2 ways: as an exception and as an object. For example, this is how to throw an error as exception:
function throw_error()
box.error({code = 1000, reason = "Error message"})
-- Or
error('Some error string')
end
This is how to return it as an object:
function return_error()
return box.error.new({code = 1000, reason = "Error message"})
end
If the function was called remotely, using IPROTO protocol via a connector like netbox, or PHP connector, or any other one, the error return way affects how it is encoded into MessagePack response packet. When the function throws, and the error reaches the top stack frame without being caught, it is encoded as IPROTO_ERROR (82) and IPROTO_ERROR_24 (49).
When the error object is returned as a regular value, not as an exception, it is encoded also as a regular value, inside IPROTO_DATA (48). Just like a string, a number, a tuple, etc.
With encoding as IPROTO_ERROR/IPROTO_ERROR_24 there is no much of a configuration space. Format of these values can't be changed. IPROTO_ERROR is always returned as a MessagePack map, with a stack of errors in it. IPROTO_ERROR_24 is always an error message. The IPROTO_ERROR_24 field is kept for compatibility with connectors to Tarantool versions < 2.4.1.
With encoding as a part of IPROTO_DATA you can choose serialization way using error_marshaling_enabled option. When it is true, errors are encoded as MessagePack extension type MP_EXT, and contain the whole error stack, encoded exactly like IPROTO_ERROR value. When the option is false (default behaviour in 2.4.1), the error is encoded as a string, MP_STR, which is the error's message. If there is a stack of errors, only the newest error is encoded.
error_marshaling_enabled option exists for backward compatibility, in case your application on Tarantool wants to be compatible with old connectors, which don't support MP_EXT encoded errors.
In Tarantool < 2.4.1 errors were encoded into result MessagePack as a string with error message, and error stacks didn't exist at all. So when the new format and the error stacks feature were introduced, making the new format default would be a too radical change breaking the old connectors.
Consider these examples of how error marshaling affects results. I use Tarantool 2.4.1 console here, and built-in netbox connector. The code below can be copy pasted into the console.
First instance:
box.cfg{listen = 3313}
box.schema.user.grant('guest', 'super')
function throw_error()
box.error({code = 1000, reason = "Error message"})
end
function return_error()
return box.error.new({code = 1000, reason = "Error message"})
end
Second instance:
netbox = require('net.box')
c = netbox.connect(3313)
Now I try to call the function on the second instance:
tarantool> c:call('throw_error')
---
- error: Error message
...
The c:call('throw_error') threw an exception. If I catch it using pcall() Lua function, I will see the error object.
tarantool> ok, err = pcall(c.call, c, 'throw_error')
tarantool> err:unpack()
---
- code: 1000
base_type: ClientError
type: ClientError
message: Error message
trace:
- file: '[string "function throw_error()..."]'
line: 2
...
As you can see, I didn't set error_marshaling_enabled, but got the full error. Now I will call the other function, without exceptions. But the error object won't be full.
tarantool> err = c:call('return_error')
tarantool> err
---
- Error message
...
tarantool> err:unpack()
---
- error: '[string "return err:unpack()"]:1: attempt to call method ''unpack'' (a nil
value)'
...
The error was returned as a mere string, error message. Not as an error object. Now I will turn on the marshaling:
tarantool> c:eval('box.session.settings.error_marshaling_enabled = true')
---
...
tarantool> err = c:call('return_error')
---
...
tarantool> err:unpack()
---
- code: 1000
base_type: ClientError
type: ClientError
message: Error message
trace:
- file: '[C]'
line: 4294967295
...
Now the same function returned the error in the new format, more featured.
On the summary: error_marshaling_enabled affects only returned errors. Not thrown errors.

Gradle: Modifying contents of a property file inside a jar file

There a is config.properties file in the project.jar file.
I need to modify one of the property in this file without extracting the jar file. How to do this and is it safe to do this ,since we are modifying Jar?
Code I tried is:
def configProperties = new Properties()
def configPropFile = projectJar + '/config.properties'
configProperties.load(configPropFile)
configProperties.setProperty('versions', '1.7)
configProperties.store(configPropFile.newWriter(), null)
This gives me exception:
Execution failed for task 'changeProp'.
> No signature of method: java.util.Properties.load() is applicable for argument types: (java.lang.String) values: [/com/codebase/project/config.properties]
Possible solutions: load(java.io.InputStream), load(java.io.Reader), clear(), clone(), sort(), find()
Also tried:
configProperties.load(ClassLoader.getResourceAsStream(configPropFile))
This gives me exception:
> Ambiguous method overloading for method java.util.Properties#load.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.io.InputStream]
[class java.io.Reader]
I am new to gradle, Can some one help me with this?

Acceleo java wrapping service doesn't take complex parameter - Invalid result for expression self.invoke

I can't call a java wrapping service in Acceleo because it doesn't recognize parameters type. This is my simple test code: the main calls a query stored in Services.mtl, that calls the java service that just return the name of an object "Send"
Main.mtl
[file ('system.P', false, 'UTF-8')]
[for (t : Send | aSystemBehavior.transitions)) ]
[getName(t)/]
[/for]
[/file]
Services.mtl
[query public getName(arg0 : Send) : String
= invoke('myPackage.Services', 'getName(myPackage.Send)', Sequence{arg0})
/]
Services.java
public class Services
{
public String getName(Send t)
{return t.getName();}
}
The Error Log shows:
Invalid result for expression
self.invoke('myPakage.Services',
'getName(myPakage.Send)', Sequence {arg0}) at line 0 in
Module services for query getName(Send). Last recorded value of self
was org.eclipse.emf.ecore.impl.DynamicEObjectImpl#1f00eb36 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl#2c2aade3 (name: Send)
(instanceClassName: null) (abstract: false, interface: false)).
Problem found while generating the file system.P'.
If I use a String as parameter type instead of Send, everything works fine.
Does the package containing the service "Services" has been exported? If not, open the file MANIFEST.MF, go in the runtime tab and add its package to the list of exported packages. Are you sure that your "Send" object has a name? This message only indicates that null was returned by the query getName.
I don't have anymore this problem... I created a new Acceleo project from scratch, and it works. I am not sure what was the problem... maybe it's something about che choice of metamodels to import during the creation of the Module (I have to choose between run-tim and develop-time metamodel).

Resources