con:settings Elements in Workspace and Project Files - configuration

I am using the free edition of SoapUI (version 4.6.1) with multiple workspaces. One of my frustrations is that SoapUI does not seem to support workspace-level custom properties.
The *-soapui-workspace.xml files I have reviewed contain an empty con:settings element (i.e. <con:settings/>). Same in the *-soapui-project.xml files I have reviewed.
My intuition & hope is that these elements allow workspace- or project-level additions to or overrides of settings I see in my general soapui-settings.xml file - e.g. additional global properties that I want when a given workspace is loaded.
However, when I create a settings file SomeService Tests-soapui-settings.xml that contains...
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-settings xmlns:con="http://eviware.com/soapui/config">
<con:setting id="GlobalPropertySettings#properties"><![CDATA[<xml-fragment xmlns:con="http://eviware.com/soapui/config">
<con:property>
<con:name>WorkspaceCustomPropertyTest</con:name>
<con:value>some value</con:value>
</con:property>
</xml-fragment>]]>
</con:setting>
</con:soapui-settings>
...and set the con:settings element in the SomeService Tests-soapui-workspace.xml file like so...
<?xml version="1.0" encoding="UTF-8"?>
<con:soapui-workspace name="SomeService Tests" soapui-version="4.6.1" projectRoot="${workspaceDir}" xmlns:con="http://eviware.com/soapui/config">
<con:description>Workspace to organize all SomeService test projects.</con:description>
<con:settings>SomeService Tests-soapui-settings.xml</con:settings> <!-- Reference the workspace settings file. -->
<con:project name="SomeService Authentication Tests">SomeService Authentication Tests-soapui-project.xml</con:project>
</con:soapui-workspace>
..., nothing happens.
I do not get an error upon loading the workspace, but I also do not get any indication that the con:settings element is doing anything either. For example, SoapUI Preferences > Global Properties does not list a WorkspaceCustomPropertyTest property.
I can keep tinkering of course, but an explanation of the workspace- and project-file con:settings elements would help.
Searching SO, the SmartBear SoapUI forum, and more broadly for an explanation of the workspace- and project-file con:settings elements has yielded nothing so far.
Can anyone explain how to use the workspace- and project-file con:settings elements?
Alternatively, can anyone shed light on how to achieve a similar result (i.e. workspace-level custom properties) with the free edition of SoapUI?

What about that?
Create a ini("myconfig.groovy") file("assuming that this file will be in the same directory of your project file"):
global_property='Global value'
Use this groovy script to grab the property:
// Script imports
import com.eviware.soapui.support.GroovyUtils
import groovy.util.ConfigSlurper
// Grovvy utils handle OS directories path abstraction
def groovyUtils = new GroovyUtils(context)
def config = new ConfigSlurper().parse(new File(groovyUtils.projectPath + '/myconfig.groovy').toURL())
// Just logging the property but you can set the property here
log.info config.global_property
Then you can add the value to the desired object at run time.

It doesn't seem possible to do it at the workspace level. You could do it at one of the testing levels, see: http://www.soapui.org/Functional-Testing/working-with-properties.html

SoapUI does support global properties.
In File> Preferences> Global Properties
Here you can assign Global Properties that spans all projects. Sadly, currently, it will be used for all work spaces. Hope this helps, having a groovy script to manually handle everything just seems a bit over kill to me.

Related

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry

Uncaught DOMException: Failed to execute 'define' on 'CustomElementRegistry': this name has already been used with this registry
at http://127.0.0.1:8000/components/#polymer/polymer/lib/elements/dom-module.js:175:16
Tried deleting node-modules and package-lock and reinstalling did not work.
this error is due to a custom element tag-name being registered which is already registered; to fix simply check that an element by this name hasn't already been registered. This example solution checks to see if something is already registered using the existing API and if not, registers the given Class (inheriting from/extending HTMLElement--at some point):
customElements.get('the-element') || customElements.define('the-element', HTMLTheElement);
For more on the API see https://developer.mozilla.org/docs/Web/API/CustomElementRegistry
most/mature libraries address this problem and those that don't, or are mangled by package and build process complexities can have it pop up; in most cases either updating to a current version, migrating to Lit (https://lit.dev) or patching the problem somehow provides a path to a solution; note the simpler solutions are far easier to maintain--as can be seen in the conflation of npm, polymer over the actual error in the original question; the Polymer project became lit-html and LitElement, and recently rebranded as "Lit" (and still includes these lit-things). Professionally I'm migrating away from npm and Nodejs to Deno with the aim of generally resolve the many problems related to npm and tooling insecurity and complexity, however this answer provides a more direct solution (understand the problem and fix directly, or update to the relevant latest solution which includes this somehow).
Well, this worked for me, with no Typescript warnings,
if (!customElements.get('the-element')) { customElements.define('the-element', HTMLTheElement); }
Hope someone will find this useful.
Cheers.
It is unwise to use the answers above. You want it to fail! The reason being is that your NPM should be deduping duplicate packages, so the fact that you see a certain component being defined on the custom elements registry more than once is a crucial error that you need to debug why the same component is registered more than once.
How to debug, in short, go to your browser, inspect element, network tab, refresh, figure out which files are both registering the same element. Then check in the initiator to see which files are loading those files. Then you get a way better idea of why your app is not resolving the same import to a single place (your deduped dependency).
One reason why you might face this problem is due to semver. If you have multiple different major versions of the same dependency, NPM cannot just dedupe all of the installations to your root node_modules. How you solve this is up to you. Some people use npm-aliases for their different majors of a dependency, some people implement a plugin in their build-tool to resolve paths to a single installation, etc.
For people that can't use #jimmonts answer because the issue is in one of their dependencies you can use the following snippet:
This happens for us, because a package we are using defines an element. But this package is used by multiple apps. And these apps, wouldn't you know it, interact. So customElements.define('x-tag', className) gets called multiple times. And the second time it does, it crashes the app.
function safeDecorator(fn) {
// eslint-disable-next-line func-names
return function(...args) {
try {
return fn.apply(this, args);
} catch (error) {
if (
error instanceof DOMException &&
error.message.includes('has already been used with this registry')
) {
return false;
}
throw error;
}
};
}
customElements.define = safeDecorator(customElements.define);
I was getting the same error. You may not have the same issue as me but I thought I would drop my solution here just incase someone runs into the same issue in the future.
I had two modules that both imported the same custom element module, one of the was importing Module.js and the other module.js. Now the browser saw this as two separate files because URLs can be case sensitive, except my server saw this as one file because it is not case sensitive (express.js) or at least it was able to resolve the path to the correct file even with the incorrect case. And so the browser saw two "different" modules both defining the same custom element, but when I searched my source code only one file was defining the custom element.
I had this problem and found out that I was calling on my boundle.js file twice. Since I was using Webpack and HtmlWebpackPlugin, HtmlWebpackPlugin added the reference to my boundled file to my index.html file where I had already referenced it by hand.
I developed a solution, thats overrite the define with a precheck before define. It works fine for me, just ad the 2 lines into your index.js
customElements.defineclone = Object.assign(Object.create(Object.getPrototypeOf(customElements)).define, customElements);
customElements.define = (name, element) => customElements.get(name) || customElements.defineclone(name, element);

KotlinTestEngine.discover() doesn't return any tests

My goal is to have a class which can find any tests written in kotlintest. I already have working code for Java/Scala/Groovy unit tests but can't get it to work for Kotlintest.
My discover code:
LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request().selectors(selectPackage("com.example")).build();
descriptor = new KotlinTestEngine().discover(request, uniqueId);
UniqueId has value of "engine:junit-example". I tried adding the following code but it doesn't work either.
new DiscoverySelectorResolver().resolveSelectors(discoveryRequest, descriptor);
The descriptor contains all the classes with tests but no test methods. In other cases it is enough to call descriptor.getChildren() to get the test methods but with Kotlintest I get empty list.
Thanks for any help.
The reason your code doesn't work is because KotlinTest doesn't honour package name selectors. This could be considered a bug in KotlinTest.
It does honour classpath, class, directory and uri selectors though.
Edit:
As of 3.2 KotlinTest now supports package selectors so your code will work.

Spring-ldap configuration issue

I am trying to configure a spring-ldap context source and I find the following example in the documentation:
<ldap:context-source
username="cn=Administrator"
password="secret"
url="ldap://localhost:389"
base="dc=261consulting,dc=com" />
I would like to be able to specify the userid/password and, if possible, the url and port elsewhere (like a JNDI reference from a datasource). I can't find any context source example or spec in the documentation (or in google) that has this sort of configuration. Can I do it and how?
Beyond using a properties file, no.
You can instantiate the class: org.springframework.ldap.core.support.LdapContextSource internally in your application and then set the values: url, base, userDn, password, referral, etc.
In the spring-ldap samples you will find how to use it. Here is an example!
I hope it helps!

How to get selected properties of a child node under a node?

i am new in adobe cq5 .I created a page test in my repository inside the
content node of page.I have 100 nodes example test-1 , test-2,test-3....test-100.I want to retrieve the selected properties of these nodes like name , modification date etc.How can i achieve this ? can anybody help regarding this.
From your question title, you want to get a JSON representation of your nodes. This is a built in feature (which should be blocked on the dispatcher though):
Just add .X.json to your path whereas X is a the depth, e.g. http://localhost:4502/content.2.json
If you want to have XML you can just add the extenstion .xml to your path, though there it will just return the properties of the specified page and not the complete hierarchy as with JSON.
If you want get data through all hierarchy use 'infinity' selector and 'json' extension.
for example
http://localhost:4502/content/geometrixx/en/toolbar.infinity.json
Out of the box you can use the parent-folder-of-your-nodes.N.json notation as shown above.
If you need a specific format with just those properties you can write a script or servlet and mount it on a specific selector so that parent-folder-of-your-nodes.your-selector.json returns your custom format.
The http://sling.apache.org/documentation/the-sling-engine/servlets.html documentation should help with that, and there are numerous examples of such Sling servlets and scripts in the Apache Sling source code, for example under http://svn.apache.org/repos/asf/sling/trunk/launchpad/

Enabling json calbacks in Alfresco 4.0

Hello I'm in a bit of a jam here.
I'm trying to activate json calbacks (jsonp) on Alfresco 4.0.b following these directives.
http://wiki.alfresco.com/wiki/Web_Scripts#JSON_Callbacks
If I understand correctly for me to activate this feature for webscripts I need to modify this file /Alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/web-scripts-application-context.xml and add a property
<property name="allowCallbacks"><value>true</value></property>
to any bean definition I want json callbacks on.
Now from what I read everywhere you should never ever modify files inside alfresco.war or share.war. So here is my question:
How would I go about modifying this file outside of the alfresco war?
I tried copying the file to /Alfresco/tomcat/shared/classes/alfresco/web-scripts-application-context.xml and adding the propertie to the webscripts.container bean and the webscripts.authenticator.basic bean but both my script and the basic authentication script are not returning my results wrappped in my my_function when I use alf_callback=my_function
Any help would be greatly appreciated.
Thanks
Just placing a customized copy in shared/classes/alfresco does not work as beans still resolve from alfresco/WEB-INFO/classes/alfresco.
Try putting your customizations in shared/classes/alfresco/extension/whatever-context.xml.
The order of the imports is defined in alfresco/WEB-INF/classes/alfresco/application-context.xml - the last definition overrides and "wins".