How to remove Custom Properties from a SoapUI TestCase using Groovy? - groovy

I have created some list of properties under the TestCase. For example look at the following screenshot.
I tried to remove Testcase_Property property through the following groovy script teststep:
testRunner.testCase.testSuite.removeProperty( "Testcase_Property" );
when I reload the project, the Testcase_Property property is still exist in the Custom Properties tab when I click on the Test case name.
Anyone suggest me what the correct script to remove the custom properties in SoapUI.
Thanks
Karunagara Pandi

you can also use the following:
data = context.testCase.getTestStepByName("Test Case Name");
String[] propToRemove = new String[data.getPropertyCount()];
propToRemove = data.getPropertyNames();
for ( int i = 0 ; i < propToRemove.size(); i++ ){
data.removeProperty( propToRemove[i] );
}
Hope this helps.
Now you can remove more than one prop.

Finally I got the answers for removing Project, Testsuite and Testcase custom properties. Here are the scripts.
testRunner.testCase.testSuite.project.removeProperty( "Project_Level_Property" );
testRunner.testCase.testSuite.removeProperty( "Testsuite_Property" );
testRunner.testCase.removeProperty( "Testcase_Property" );
If any other way is there, please let me know friends.

Manual solution: use "Save Properties" and "Load Properties" from SoapUI
export the properties to a text file, e.g. customprop.txt
edit the file and delete the unwanted properties
import the file back into your soapUI project
in the "load properties" dialog check the option to "delete remaining"
Then the existing properties will be cleared out and replaced with your customprop.txt

Just for completeness:
Another quick but dirty and dangerous way is to modify the soapui-project.xml and remove the property nodes with a text editor.
Be aware that you can break your whole project if you do something wrong!
You should create a copy of your soapui-project.xml and do the following steps:
Set the values of the Properties you want to delete to deleteMe
Search for the string deleteMe in your soapui-project.xml
Delete the properties:
<con:property><con:name>name</con:name><con:value>deleteMe</con:value></con:property>

Related

This row was already applied and cannot be modified

When i run my code in the test environment to test my new code about kudu insert,it reports to me:
This row was already applied and cannot be modified.
I have already tried to debug my code and to see what is the problem in my code , but it is useless
if((map.get(list.get(i))) instanceof Double){
row.addDouble(list.get(i), (Double) map.get(list.get(i)));
//System.out.println("Double type insert succeed : " + list.get(i) + " : " + map.get(list.get(i)));
continue;
}
I want to know what's wrong in my code because in my previous code i can run correct but know it cannot
In the source code ,The class was that PartialRow has a private propertiy:frozen, It's default value was false,but in my code,when i debug in it,i found that value was true,I think this is the reason that cause the program reports to my : This row was alredy applied and cannot be modified ! asking for help .please
Without full stacktrace and the rest of code I can only guess why this is happening.
My guess is because the Insert object on which this row object is created has already inserted to Kudu (using KuduSession.apply) and then you tried to update it using row.addDouble.
If you are unsure about why please see this example of how to insert into Kudu.
KuduSession.apply method is invoked on Insert object on which PartialRow object is created, this will insert the data from all the PartialRow objects created from the Insert object. This can be done only once on one Insert object. After that you create a new Insert object using KuduTable.newInsert()
In your case you should probably create new object of Insert using KuduTable.newInsert() and create a row object on this.

Failed to add fields.Selection to parent model

I'm working on access restriction to res.partner.
Currently I have two questions:
1.Why does this code don't create new field to inherited model (first error was something like "unknown object _", now it's gone): (Now it works, first question is answered)
from odoo import models, fields
class partner(models.Model):
_inherit = 'res.partner'
privacy_visibility = fields.Selection([
('followers', _('On invitation only')),
('employees', _('Visible by all employees')),
#error was here. according to odoo documentation, here is a comma
#if you remove it, the code works: [![enter image description here][1]][1]([('',''),('',''),('','')])
],
string='Privacy', required=True,
default='employees',
help="Holds visibility of the partner that affects currently logged user:\n"
"- On invitation only: Employee may only see the followed partners\n"
"- Visible by all employees: Employee may see selected partner\n")
Later, when my restrictions would be applied, how to make selected users to access all pertners anyway? (my ideas - 1.to hide "privacy_visibility" field to be visible in developer mode only, as it made for project's "sub-task project". 2.to create a new group, but I have no idea how to use access groups with row-level access), which way wold you recommend to go?
First Question Ans:
The Selection field syntax is not correct please follow this syntax
Example:
gender = fields.Selection([('male', 'Male'), ('female', 'Female'), ('any', 'Any')], string='Gender')
You are calling the translate object (the underscore "_") to translate your selection values, but you did not import it.
Change:
from odoo import models, fields
To:
from odoo import models, fields, _

How to set the version fields of a JIRA ticket from Groovy

I'm using JIRA 7.1.4 Server and under Behaviours I'm trying to create a Groovy Initialiser Function for setting default values of form fields, so when the user tries to create a new ticket, some fields are already filled in with default values. This is what I have so far:
import com.atlassian.jira.component.ComponentAccessor
def versionManager = ComponentAccessor.getVersionManager()
def versions = versionManager.getVersionsUnreleased(issueContext.projectObject.id, false)
getFieldById("affectedVersion").setFormValue([versions.first().id])
getFieldById("description").setFormValue([versions.first().id])
When the dialog for creating a new JIRA ticket opens, this script successfully sets the "Description" field to the right version id (only for debugging purposes), but the "Affects Version/s" field remains empty for some reason.
I think the id of the "Affects Version/s" field is OK, because I got it from JQL, so e.g. the following query displays correct information:
project = "--------" and affectedVersion is EMPTY
Therefore I assume that I'm trying to set the value of the version field incorrectly, but cannot figure out the mistake. The above Groovy script is based on this example, but the script might be wrong, and I was not able to find more information about getFieldById or setFormValue here either.
Can anyone give a working example of setting JIRA's "Affects Version/s" or "Fix Version/s" fields from Groovy?
If you setting fixversion on issue create step in workflow. You need to put this script into first post function(before issue create).
import com.atlassian.jira.component.ComponentAccessor
def versionManager = ComponentAccessor.getVersionManager()
def versions = versionManager.getVersionsUnreleased(issue.getProjectObject().getId(), false)
issue.setAffectedVersions([versions.first()])

Maximo: can i filter the list on multiple criteria of Status field

when i list the inventory, the default setting filters the Status field with "!=OBSOLETE".
Can I put in a command that will not list any items with status of obsolete or pendobs.
or filter the list on 2 different status'
You can filter the list to two different statuses. For that you put something like (without the quotes) "=status1, =status2".
That same trick never worked for me to filter out more than one status. "!=status1, !=status2", for example, would not work.
Saved and default queries can help take care of that if you wish.
If you have access to the Where Clause, you could edit there query to state something like this:
status not in ('obsolete', 'pendobs')
This is the best way I've found to do an exclusive query as opposed to the standard inclusive query.
Out of the box, you can add PENDOBS to the filter so you exclude OBSOLETE and PENDOBS. If you want the behavior of the application to change, you have to edit the Java .class file in this case. Some modules allow you to edit this from Application Designer, but it is strange that Inventory module, requires editing the .class file.
c:\IBM\SMP\maximo\applications\maximo\maximouiweb\webmodule\WEB-INF\classes\psdi\webclient\beans\item\ItemAppBean.class
Below is the relevant Java code. You'd have to edit the Java file and rebuild your maximo.ear for the List view to exclude PENDOBS from the list view.
public void initializeApp()
throws MXException, RemoteException
{
DataBean resultsBean = app.getResultsBean();
Translate translate = MXServer.getMXServer().getMaximoDD().getTranslator();
String status = (new StringBuilder()).append("!=").append(translate.toExternalDefaultValue("ITEMSTATUS", "OBSOLETE", null, null)).toString();
resultsBean.setQbe("status", status);
resultsBean.reset();
super.initializeApp();
}

What to do when get "The model used to open the store is incompatible with the one used to create the store"?

I had a core data EntityDescription and I created data in it. Then, I changed the EntityDescription, added new one, deleted the old one using the editor for xcdatamodeld file.
Now any of my code for core data causes this error "The model used to open the store is incompatible with the one used to create the store}". The detail is below. What should I do? I prefer to remove everything in the data model and restart new one.
Thanks for any suggestion!
reason=The model used to open the store is incompatible with the one used to create the store}, {
metadata = {
NSPersistenceFrameworkVersion = 320;
NSStoreModelVersionHashes = {
Promotion = <472663da d6da8cb6 ed22de03 eca7d7f4 9f692d88 a0f273b7 8db38989 0d34ba35>;
};
NSStoreModelVersionHashesVersion = 3;
NSStoreModelVersionIdentifiers = (
);
NSStoreType = SQLite;
NSStoreUUID = "9D6F4C7E-53E2-476A-9829-5024691CED03";
"_NSAutoVacuumLevel" = 2;
};
Or if you're in dev mode, you can also just delete the app and run it again.
Deleting the app is sometimes not the case! Suggest, your app has already been published! You can't just add new entity to the data base and go ahead - you need to perform migration!
For those who doesn't want to dig into documentation and is searching for a quick fix:
Open your .xcdatamodeld file
click on Editor
select Add model version...
Add a new version of your model (the new group of datamodels added)
select the main file, open file inspector (right-hand panel) and under Versioned core data model select your new version of data model for current data model
THAT'S NOT ALL ) You should perform so called "light migration".
Go to your AppDelegate and find where the persistentStoreCoordinator is being created
Find this line if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error])
Replace nil options with #{NSMigratePersistentStoresAutomaticallyOption:#YES, NSInferMappingModelAutomaticallyOption:#YES} (actually provided in the commented code in that method)
Here you go, have fun!
P.S. This only applies for lightweight migration. For your migration to qualify as a lightweight migration, your changes must be confined to this narrow band:
Add or remove a property (attribute or relationship).
Make a nonoptional property optional.
Make an optional attribute nonoptional, as long as you provide a default value.
Add or remove an entity.
Rename a property.
Rename an entity.
Answer borrowed from Stas
If this is a non-production app, just delete your local database (appname.sqlite) and restart the app.
I find I'm always doing this, and so provide the following additional detail:
Under XCode 4 (4.3.2) you should find your datastore here:
/Users/~/Library/Application Support/iPhone Simulator/simulatorVersion/Applications/yourAppIdentifier/Documents
Or you can use Spotlight, if you first enable searching for System Files; I've found it fastest to save such a search to the menu bar.
If this is a non-production app, just delete your local database (appname.sqlite) and restart the app.
Delete your app on simulator and restart:
On simulator, go to Hardware -> Home:
Click and hold mouse button on your application icon:
Click on "X" in app icon to delete:
Go back to Xcode and restart your application(Command+R):
or:
PS.:
If the error appears again, review your code because the problem should be in the syntax or discrepancy between what you want to list with the data model that you have.
Reset your simulator and run again. If you were to run with a different device in the simulator, it would work. If you are running with an iphone 6s simulator and you try to run 6s plus, it would still work without resetting.
If running on a phone, make sure to delete the app and rerun it
I have faced the same issue using Xcode 7 beta 1 and the following action has resolved the issue.
Menu==>> click on Window>Projects>select project on the left hand side and click on delete button which is located on the right side.
If still doesn't work,
=> reset the simulator and run the app

Resources