interact with the sample CorDappVia the interactive shell - corda

When i checked the output :run vaultQuery contractStateType: com.example.state.IOUState
it show :
Could not parse as a command: Cannot construct instance of java.lang.Class, problem: com.example.state.IOUState
at [Source: UNKNOWN; line: -1, column: -1]

I typed net.corda.samples.example.states.IOUState and it worked.
You see the package name in ExampleFlow.kt.

Nice #shok1122.
Paste & run: run vaultTrack contractStateType: net.corda.samples.example.states.IOUState

Related

Trimmomatic-0.39 error message "Unknown option -baseout ..."

I have used Trimmomatic-0.39 few times already for trimming some sequencing data. This time I tried the option -baseout as stated in the manual but it does not recognise it as a valid option and the command does not run. If I run the command, as I usually I do with all the output files listed, it works though.
I type in the command line:
java -jar trimmomatic-0.39.jar PE -phred33 -trimlog trimmed_file18_log.log -baseout file18.fastq.gz file18-R1.fastq.gz file18-R2.fastq.gz ILLUMINACLIP:NexteraPE-PE.fa:2:30:10 MAXINFO:25:0.2 MINLEN:20
What I get back is:
Unknown option -baseout file18.fastq.gz
Usage:
PE [-version] [-threads <threads>] [-phred33|-phred64] [-trimlog <trimLogFile>] [-summary <statsSummaryFile>] [-quiet] [-validatePairs] [-basein <inputBase> | <inputFile1> <inputFile2>] [-baseout <outputBase> | <outputFile1P> <outputFile1U> <outputFile2P> <outputFile2U>] <trimmer1>...
or: .....
I get back the same error message even if I move the '-baseout file18.fastq.gz' option after '...jar PE' and before the list of all the other options.

Pytest failing on file open command string assert - what's the best way to test this?

I am constructing a command to pass to requests library to Post an attachment - as in
files= attachment = {"attachment": ("image.png", open("C:\tmp\sensor.png", "rb"), "image/png")}
The code is working but I cannot get PyTest to test it as -is because of the open command which is executed when evaluated. Here is simplified code of the problem
import pytest
def openfile():
cmd = {"cmd": open(r"C:\tmp\sensor.png")}
return cmd
def test_openfile():
cmd = openfile()
#assert str(cmd) == str({"cmd": open(r"C:\tmp\sensor.png")}) # this works
assert cmd == {"cmd": open(r"C:\tmp\sensor.png")} # this does not
PyTest complains that the two side are different but then confirms they are the same in the diff panel!
Expected :{'cmd': <_io.TextIOWrapper name='C:\tmp\sensor.png' mode='r' encoding='cp1252'>}
Actual :{'cmd': <_io.TextIOWrapper name='C:\tmp\sensor.png' mode='r' encoding='cp1252'>}
'Click to see difference' - Opening diff panel reports 'Contents are identical'!
I can just stick with comparing the generated string with expected string but am wondering if there is a better way to do this.
Ideas?
You need to test the properties of the actual file buffer that is returned by the open call, instead of the references to that buffer, for example:
def test_openfile():
cmd = openfile()
expected_filename = r"C:\tmp\sensor.png"
assert "cmd" in cmd
file_cmd = cmd["cmd"]
assert file_cmd.name == expected_filename
with open(expected_filename) as f:
contents = f.read()
assert file_cmd.read() == contents
Note that in a test you may not have the file contents, or have them in another place like a fixture, so testing the file contents may have to be adapted, or may not be needed, depending on what you want to test.
After talking this through with a friend I think my original approach is perfectly valid. For anyone that trips over this question here's why:
I am trying to pytest building of an executable parameter to pass to another library for execution. The execution of the parameter is not relevant, just that it is correctly formatted. The test is to compare what is generated with the expected parameter ( as if I typed it) .
Therefore casting to string or json and comparing is appropriate since that is what a human does to manually check the code!

Read Until usage in robot framework with constant changing prompt

I'm new to robot framework. I'm trying to create a Keyword in my suite to login to DUT, run a command and fetch the output. but the prompt of the DUT is constantly changing. Following is the keyword and also the command output in DUT.
Keyword snippet:
Write show table sys ClassOfService
${output}= Read Until Regexp admin#0-9 .*\>
command output in DUT:
admin#0-9 19:36:44> show table sys ClassOfService
profileXml "<?xml version=\"1.0\" encoding=\"UTF-8\"?><cos version=\"1.0\"> <PublicIdentifiers>
</PublicIdentifiers> \t\t\t </cos>";
[ok][2020-04-11 19:36:45]
admin#0-9 19:36:45>
But it is always getting timeout. Please let me know if I'm missing something.
Thanks in Advance
Your regular expression looks good, but in Robot Framework the > must have the \ escaped with another \. Look at the example for Read Until Regexp. Your final command should be:
Write show table sys ClassOfService
${output}= Read Until Regexp admin#0-9 .*\\>

How to pass input to interactive command using ansible?

I have a command to execute on Unix server. The command expect user input at two points and then proceed further. The command is like follows:
$ abc_1.2_udate.bin /tmp/log
Do you want to proceed y/n?
y
Please provide the credentials:
1234
From ansible tried as follows:
- name: execute the cmnd
expect:
Command: abc_1.2_udate.bin /tmp/log
responses:
Do you want to proceed y/n? "y"
'Please provide the credentials:' "1234"
But the above piece does not work. Also I want to use expect module only for this.
Change Command to command (C is not caps)
Responses should be given in quotes with the format 'Enter': "y"
expect:
command: abc_1.2_udate.bin /tmp/log
responses:
'Do you want to proceed y/n?': "y"
'Please provide the credentials': "1234"

How to fix "Escaping empty cells with '\' before line continuation marker '...' is deprecated" error in Robot Framework?

I keep on getting this error when running my Robot Framework script:
"Escaping empty cells with '\' before line continuation marker '...' is deprecated. Remove escaping before Robot Framework 3.2."
Here is a sample code:
*** Test Cases ***
Debug
${Str} = Set Variable Rose
: FOR ${Ctr} IN RANGE 1 5
\ Run Keyword If '${Str}' == 'Test' Log Test
\ ... ELSE Log Not Test
I searched for a solution and I only got this link: https://gerrit.openbmc-project.xyz/#/c/openbmc/openbmc-test-automation/+/22245/
I can see that they used FOR/END instead of :FOR (which was working fine before).
FOR ${userid} IN RANGE 2 16
${user_info}= Get User Info ${userid}
Run Keyword If "${user_info['user_name']}" != ""
... Run IPMI Standard Command user set name ${userid} ""
END
However, when I try to change my code to use FOR/END, RIDE automatically changes it back to :FOR.
I use RIDE heavily and would like to continue to do so I need it to work around this error. My RIDE is the latest one so upgrade won't work. Any help would be appreciated.
The syntax for the FOR-loop is changed. From the documentation:
Not closing loops with END, escaping keywords inside loops with \, and
using :FOR instead of FOR are all going to be deprecated in Robot
Framework 3.2. Users are advised to switch to the new syntax as soon
as possible.
With your code I can still run the test, but the deprecation warning is shown. To remove the warning this worked for me in Eclipse:
Debug
${Str} = Set Variable Rose
:FOR ${Ctr} IN RANGE 1 5
\ Run Keyword If '${Str}' == 'Test' Log Test
... ELSE Log Not Test
When you remove the escape character in the ELSE line the warning is no longer shown. This is a workaround though, untill a new version of RIDE comes along I guess.

Resources