HP ALM OTA-API: How to update a test in testlab knowing the id? - testing

I know the id of a test that is in a Testset and want to update your status, know how to do it using the API OTA?
Edit:
Thanks but current answer unfortunately doesn't work for me .
I put the example ( java) :
ITestSetFactory sTestFactory = (itdc.testSetFactory()).queryInterface(ITestSetFactory.class);
ITDFilter filterF=sTestFactory.filter().queryInterface(ITDFilter.class);
filterF.filter("TC_TEST_ID","531729");
System.out.println(filterF.newList().count());
The error:
Exception in thread "main" com4j.ComException: 800403ea (Unknown error) : Failed to Get Test Set Value : .\invoke.cpp:517
at com4j.Wrapper.invoke(Wrapper.java:166)
at com.sun.proxy.$Proxy13.newList(Unknown Source)
at TestQC.main(TestQC.java:64)
Any suggestions ?

The error occurs because you use the TestSetFactory instead of the TSTestFactory. You should use itdc.tsTestFactory() because it is TSTest objects you want to manipulate (aka test instances), not TestSet objects. The simplest way is to get the TSTestFactory of your TDConnection object, and use a filter to get the TSTest object and then set its status. Example code in Ruby:
ts_test_factory = tdc.TSTestFactory
filter = ts_test_factory.Filter
filter["TC_TEST_ID"] = "123" # test id from test plan
found_test_instances = filter.NewList
test_instance = found_test_instances.Item(1) # be careful if the test occurs in many test sets
test_instance.Status = "Passed"
test_instance.Post

Related

Is there a Denodo 8 VQL function or line of VQL for throwing an error in a VDP scheduler job?

My goal is to load a cache when there is new data available. Data is loaded into the source table once a day but at an unpredictable time.
I've been trying to set up a data availability trigger VDP scheduler job like described in this Denodo community post:
https://community.denodo.com/answers/question/details?questionId=9060g0000004FOtAAM&title=Run+Scheduler+Job+Based+on+Value+from+a+Query
The post describes creating a scheduler job to fail whenever the condition is not satisfied. Now the only way I've found to force an error on certain conditions is to just use (1/0) and this doesn't always work for some reason. I was wondering if there is way to do this with a function like in normal SQL, couldn't find anything in the Denodo documentation.
This is what my code currently looks like:
--Trigger job
SELECT CASE
WHEN (
data_in_cache = current_data
)
THEN 1 % 0
ELSE 1
END
FROM database.table;
The cache job waits for the trigger job to be successful so the cache will only load when the data in the cache is outdated. This doesn't always work even though I feel it should.
Hoping someone has a function or line of VQL to make Denodo scheduler VDP job result in an error.
This would be easy by creating a custom function that, when executed, just throws an Exception. It doesn't need to be an Exception, you could create your own Exception to see it in the error trace. In any case, it could be something like this...
#CustomElement(type = CustomElementType.VDPFUNCTION, name = "ERROR_SAMPLE_FUNCTION")
public class ErrorSampleVdpFunction {
#CustomExecutor
public CustomArrayValue errorSampleFunction() throws Exception {
throw new Exception("This is an error");
}
}
So you will use it like:
--Trigger job SELECT CASE WHEN ( data_in_cache = current_data ) THEN errorSampleFunction() ELSE 1 END FROM database.table;

JanusGraph:Some key(s) on index verticesIndex do not currently have status REGISTERED

I have some questions when I build a JanusGraph Mixed index.
This is my code:
mgmt = graph.openManagement();
idx = mgmt.getGraphIndex('zhh1_index');
prop = mgmt.getPropertyKey('zhang');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('uri');
mgmt.addIndexKey(idx, prop);
prop = mgmt.getPropertyKey('age');
mgmt.addIndexKey(idx, prop);
mgmt.commit();
mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();
mgmt = graph.openManagement();
mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get();
mgmt.commit();
vertex2=graph.addVertex(label,'zhh1');
vertex2.property('zhang','male');
vertex2.property('uri','/zhh1/zhanghh');
vertex2.property('age','18');
vertex3=graph.addVertex(label,'zhh1');
vertex3.property('zhang','male');
vertex3.property('uri','/zhh1/zhangheng');
When the program executes this line:
mgmt.awaitGraphIndexStatus(graph, 'zhh1_index').status(SchemaStatus.REGISTERED).call();
the the log prints these information (and about 30s later, an exception like this: the sleep was interrupt):
GraphIndexStatusReport[success=false, indexName='zhh1_index', targetStatus=ENABLED, notConverged={jiyq=INSTALLED, zhang=INSTALLED, uri=INSTALLED, age=INSTALLED}, converged={}, elapsed=PT1M0.096S]
I was so confused about this!
It keeps printing a lot for all indexes I have. Am I doing anything wrong? How to avoid such message?
When I execute the following statement separately, the following exception is reported:
exception:java.util.concurrent.ExecutionException:
mgmt.updateIndex(mgmt.getGraphIndex('zhh1_index'),SchemaAction.ENABLE_INDEX).get();
org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Cannot invoke method get() on null object
Your index seems to be stuck in the INSTALLED state, which may happening due to a few reasons: please see this post and look at my answer-- specifically bullet numbers 2,3, and 5.
When did you buildMixedIndex() ?
REINDEX procedure may be required.

WLST capture the output of state('ms1') to a variable

I need to capture the output of the below to a variable.
I know we can get to serverRuntime or domainRuntime() trees and get the state. But need to get the below working.
wls:/owb/serverConfig> state('Server1')
Current state of 'Server1' : RUNNING
I tried two ways:
wls:/owb/serverConfig> print state('Server1')
Current state of 'Server1' : RUNNING
None
wls:/owb/serverConfig> x=state('Server1')
Current state of 'Server1' : RUNNING
wls:/owb/serverConfig> print x
None
You have to use the getState() method of server runtime mbean.
You can obtain the server runtime mbean by navigating into wlst runtime tree or by using a lookup method.
Sample:
domainRuntime()
slrBean = cmo.lookupServerLifeCycleRuntime('Server1')
status = slrBean.getState()
print 'Status of Managed Server is '+status
See also Getting Runtime Information in WLST official documentation.
This same question was raised by Dianyuan Wang with me 2011.
Here is the steps to resolve your issue.
1. Capture the output of state command using redirect, stopRedirect command
2. Use the Python regular expression in search function to extract the desired server output.
Code snippet is here
fileName='/tmp/myserver_state.txt'
redirect(fileName)
state(server_nm,'Server')
stopRedirect()
f = open(fileName)
try:
for line in f.readlines():
if re.search('Current state',line):
status[server_nm]=line
except:
continue
Now you can apply desired logic after this block.
Cheers!!
HTH
Here is what I am using and is working like charm
cd("/ServerRuntimes/ms1")
state=cmo.getState()
print state

Error: Test object id not in the object map: dmTablePopupMenu2 in a RFT script

Exception occurred during playback of script [Firewall.ASDMDcerpcInspectMap] [CRFCN0019E: RationalTestScriptException on line 150 of script Firewall.ASDMDcerpcInspectMap - com.rational.test.ft.ObjectNotInMapException: CRFCN0763E: Test object id not in the object map: dmTablePopupMenu2.].
I am using IBM Rational Functional Tester Version: 8.3.0.1 and I found the above exception in few of my scripts. I cannot see any error on the script for objects present in the script but missing in the object map , Can Anybody tell me why am I facing this problem ans how can I fix it?
Thanks in advance..
This error gets thrown when the actual object does not exist (or most likely deleted) from the Object Map however the script still has a reference for that object.
As per the error message above , could you locate what is the code on line 150 of the Script ASDMDcerpcInpectMap , and then try to track that object in the object map ?
So if the line 150 says .. button123().click(); .. then in the script explorer you should have an object by the name button123 when upon doubleclick should bring up the object map with button123() selected.
I supect the button123 is mising from the object map( deleted most likely).
Try to re-add that object to the object map ( by using the TestObject-> Insert Test Object from the Object Map) and then right click on that object in the object map and select "Add to script" , that should take care of it.

powershell embedding one variable in another one

In powershell , for a complicated reason an application needs a 6 character string as a sort of handle (Eg: abcdef) for a long asynchronous operation. I perform this using
$replaceHandle = "abcdef"
start-Job -handle $replaceHandle
The application stores the status of the asynchronous job in $abcdef (Prefixes string with $)
and i can access parameters of job Status at any time by requesting
Get-Status -ID $abcdef.ID
Problem for me in my code is i am not able to get this $abcdef.ID properly
I have tried
$($jobVar.ToString()).ID - this gives blank/errors out
maipulating $$jobVar.ID actually gives $'abcdef'.ID
How do i manage to get value of ($abcdef.ID) appropriately ?
It because $jobVar is first interpreted :
try :
write-host "the value is $($jobVar.ID)"
(Get-Variable $b -ValueOnly).Id
This worked