In our environment we have several gateway running (for each client, environment and so on, for security purposes).
These gateways have the resource cache enabled, as default configuration (see Configuring caching)
Our problem raises when we have to add a new gateway (e.g., a new customer) and try to deploy an already published API to the new gateway. In this case, we do the following:
Allocate a new machine with the gateway (they are Ubuntu 16.04 instances in AWS).
Stop the API Manager (runs in other machine)
Edit api-manager.xml in this API manager, and add the new gateway in Environments section
Start the API Manager
Try to deploy the API in the new gateway (we only check the new gateway in the Gateways sections of Publish tab)
Then we get an error, as it tries to recreate an previously existing cache
TID: [-1234] [] [2018-04-19 16:53:35,698] ERROR {org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle} - org.wso2.carbon.registry.core.exceptions.RegistryException: Execution failed for action : Publish Embedded error : FaultGatewaysException:{"PUBLISHED":{"Prototype":"Error while updating API in the gateway. Error while updating API in the gateway. Cache resourceCache already exists","Production":"Error while updating API in the gateway. Error while updating API in the gateway. Cache resourceCache already exists","Sandbox":"Error while updating API in the gateway. Error while updating API in the gateway. Cache resourceCache already exists"},"UNPUBLISHED":{}} {org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle}
This is our Gateway configuration
<APIGateway>
<!-- The environments to which an API will be published -->
<Environments>
<!-- Environments can be of different types. Allowed values are 'hybrid', 'production' and 'sandbox'.
An API deployed on a 'production' type gateway will only support production keys
An API deployed on a 'sandbox' type gateway will only support sandbox keys
An API deployed on a 'hybrid' type gateway will support both production and sandbox keys. -->
<!-- api-console element specifies whether the environment should be listed in API Console or not -->
<Environment type="production" api-console="true">
<Name>Prototype</Name>
<Description>Prototype</Description>
<ServerURL>https://apisandbox.example.com:9446/services/</ServerURL>
<GatewayEndpoint>https://apisandbox.example.com:8246</GatewayEndpoint>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
</Environment>
<Environment type="sandbox" api-console="true">
<Name>Sandbox</Name>
<Description>Sandbox</Description>
<ServerURL>https://apisandbox.example.com:9446/services/</ServerURL>
<GatewayEndpoint>https://apisandbox.example.com:8246</GatewayEndpoint>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
</Environment>
<Environment type="production" api-console="false">
<Name>Production</Name>
<Description>Production</Description>
<ServerURL>https://apigateway.example.com:9447/services/</ServerURL>
<GatewayEndpoint>https://apigateway.example.com:8247</GatewayEndpoint>
<Username>${admin.username}</Username>
<Password>${admin.password}</Password>
</Environment>
</Environments>
Even worse. After this error, the natural action is to demote to CREATED the API, and try to publish again in ALL gateways.
In this case, we get Exception occurred while trying to invoke service method updateApiFromStringerror for the previously running gateways
Which is the correct way to add a new gateway? And, how can I clean the corrupted status?
Add/update APILifeCycle in Wso2 carbon panel(hostname:9443/carbon url) with the following code. Goto extentions→ lifecycles and edit/add APILifeCycle .
<aspect name="APILifeCycle" class="org.wso2.carbon.governance.registry.extensions.aspects.DefaultLifeCycle">
<configuration type="literal">
<lifecycle>
<scxml xmlns="http://www.w3.org/2005/07/scxml"
version="1.0"
initialstate="Created">
<state id="Created">
<datamodel>
<data name="checkItems">
<item name="Deprecate old versions after publish the API" forEvent="">
</item>
<item name="Require re-subscription when publish the API" forEvent="">
</item>
</data>
<data name="transitionExecution">
<execution forEvent="Deploy as a Prototype"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Publish"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
</data>
</datamodel>
<transition event="Publish" target="Published"/>
<transition event="Deploy as a Prototype" target="Prototyped"/>
</state>
<state id="Prototyped">
<datamodel>
<data name="checkItems">
<item name="Deprecate old versions after publish the API" forEvent="">
</item>
<item name="Require re-subscription when publish the API" forEvent="">
</item>
</data>
<data name="transitionExecution">
<execution forEvent="Publish"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Demote to Created"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
</data>
</datamodel>
<transition event="Publish" target="Published"/>
<transition event="Demote to Created" target="Created"/>
<transition event="Deploy as a Prototype" target="Prototyped"/>
</state>
<state id="Published">
<datamodel>
<data name="transitionExecution">
<execution forEvent="Block"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Deprecate"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Demote to Created"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Deploy as a Prototype"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
</data>
</datamodel>
<transition event="Block" target="Blocked"/>
<transition event="Deploy as a Prototype" target="Prototyped"/>
<transition event="Demote to Created" target="Created"/>
<transition event="Deprecate" target="Deprecated"/>
<transition event="Publish" target="Published"/>
</state>
<state id="Blocked">
<datamodel>
<data name="transitionExecution">
<execution forEvent="Re-Publish"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
<execution forEvent="Deprecate"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
</data>
</datamodel>
<transition event="Deprecate" target="Deprecated"/>
<transition event="Re-Publish" target="Published"/>
</state>
<state id="Deprecated">
<datamodel>
<data name="transitionExecution">
<execution forEvent="Retire"
class="org.wso2.carbon.apimgt.impl.executors.APIExecutor">
</execution>
</data>
</datamodel>
<transition event="Retire" target="Retired"/>
</state>
<state id="Retired">
</state>
</scxml>
</lifecycle>
</configuration>
</aspect>
Follow this https://docs.wso2.com/display/AM200/Extending+the+API+Life+Cycle
Related
To get variables from a user we call user_data(user var variable_name).
<include>
<user id="1000">
<variables>
<variable name="custom_variable" value="test"/>
</variables>
</user>
</include>
We call in a way like that:
<action application="set" data="variable_name=${user_data(${caller_id_number}#${domain_name} var custom_variable)}"/>
But how to do the same with a gateway?
<include>
<gateway name="custom_gateway">
<param name="custom_param" value="test"/>
</gateway>
</include>
I think it is not possible.
FS application set is 'Set a channel variable for the channel calling the application' while gateway data is somewhere in the sofia module. However, there is a way to list gateway data from console. Have a look at sofia_gateway_data_function in the source code, hope it sheds some light on what you need to do. Good luck!
I have recently started some app development with Telerik's AppBuilder and am running into one thing that I'm not certain of. I added a custom plugin to my project (Cordova Local Notifications Plugin) which seemed to work (it shows up in my solution now under a Plugins folder), but I have no idea how to reference the scripts and such from it. According to the Telerik documentation (Reference the Custom Plugin in index.html and config.xml), they say to add includes for anything with in the plugin.xml file, yet this plugin doesn't have that.
Any ideas on how I reference their script so I can start using it? Do I just reference Plugins/cordova-plugin-local-notifications-master/www/local-notification.js file direct or something else? Here is their plugin.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="de.appplant.cordova.plugin.local-notification"
version="0.8.0dev">
<name>LocalNotification</name>
<description>The purpose of the plugin is to create an platform independent javascript interface for Cordova based mobile applications to access the specific Notification API on each platform.</description>
<repo>https://github.com/katzer/cordova-plugin-local-notifications.git</repo>
<keywords>notification, local notification, alarm, scheduler, tile, live tiles, ios, android, windows phone 8, wp8</keywords>
<license>Apache 2.0</license>
<author>Sebastián Katzer</author>
<engines>
<engine name="cordova" version=">=3.0.0" />
</engines>
<dependency id="org.apache.cordova.device" url="https://github.com/apache/cordova-plugin-device" />
<js-module src="www/local-notification.js" name="LocalNotification">
<clobbers target="plugin.notification.local" />
</js-module>
<!-- ios -->
<platform name="ios">
<config-file target="config.xml" parent="/*">
<feature name="LocalNotification">
<param name="ios-package" value="APPLocalNotification" onload="true" />
<param name="onload" value="true" />
</feature>
</config-file>
<header-file src="src/ios/APPLocalNotification.h" />
<source-file src="src/ios/APPLocalNotification.m" />
</platform>
<!-- android -->
<platform name="android">
<config-file target="res/xml/config.xml" parent="/*">
<feature name="LocalNotification">
<param name="android-package" value="de.appplant.cordova.plugin.localnotification.LocalNotification"/>
</feature>
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<!--
* The alarm receiver is triggered when a scheduled alarm is fired. This class
* reads the information in the intent and displays this information in the
* Android notification bar. The notification uses the default notification
* sound and it vibrates the phone.
-->
<receiver android:name="de.appplant.cordova.plugin.localnotification.Receiver" />
<!--
* This class is triggered upon reboot of the device. It needs to re-register
* the alarms with the AlarmManager since these alarms are lost in case of
* reboot.
-->
<receiver android:name="de.appplant.cordova.plugin.localnotification.Restore" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<!--
* The receiver activity is triggered when a notification is clicked by a user.
* The activity calls the background callback and brings the launch inten
* up to foreground.
-->
<activity android:name="de.appplant.cordova.plugin.localnotification.ReceiverActivity" android:launchMode="singleInstance" />
</config-file>
<config-file target="AndroidManifest.xml" parent="/manifest">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</config-file>
<lib-file src="libs/android/android-support-v4.jar" />
<source-file src="src/android/LocalNotification.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Receiver.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Options.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/Restore.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
<source-file src="src/android/ReceiverActivity.java" target-dir="src/de/appplant/cordova/plugin/localnotification" />
</platform>
<!-- wp8 -->
<platform name="wp8">
<config-file target="config.xml" parent="/*">
<feature name="LocalNotification">
<param name="wp-package" value="LocalNotification"/>
</feature>
</config-file>
<source-file src="src/wp8/LocalNotification.cs" />
<source-file src="src/wp8/Options.cs" />
</platform>
</plugin>
Any JavaScript file references are automatically inserted into your app when AppBuilder creates a build, so there is really not much you have to do aside from including the plugin. BTW, you should look for custom plugins first on the Verified Plugins Marketplace - which includes instructions on including the plugin in your AppBuilder project.
I want to express a fine-grained access control use case with XACML 3.0 for an XML document but I don't know whether I can use a full XPath expression like
for $a in fn:distinct-values(sales/clientid)return (fn:sum(sales[clientid = $a]/value)
This my XML:
<?xml version="1.0"?>
<database>
<sales>
<salesid>1</salesid>
<clientid>1</clientid>
<value>1000</value>
</sales>
<sales>
<salesid>2</salesid>
<clientid>1</clientid>
<value>10000</value>
</sales>
<sales>
<salesid>3</salesid>
<clientid>2</clientid>
<value>500</value>
</sales>
<client>
<clientid>1</clientid>
<nom>a</nom>
</client>
<client>
<clientid>2</clientid>
<nom>b</nom>
</client>
</database>
How can I limit the access to the clients who have a sales value less than 10,000?
As I understand your requirement, you need to apply XACML policy based on the xml schema as described above. The sample xml needed to be in XACML request else if you are planning to read from xml as repository you may need to write a custom PIP.
You can achieve the XPath based policy design for the same, provided that the xml input for the client details is available in XACML request inside element as below sample:
<Attributes Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
<Content>
<client id="xxxx">
<sales id="yyyy">
<value>1234</value>
</sales>
</client>
</Content>
</Attributes>
Then you can create the policy based for your use case as below sample:
<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xacml="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="sample-xpath-policy" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:first-applicable" Version="1.0">
<Description>Sample XPath policy</Description>
<PolicyDefaults>
<XPathVersion>http://www.w3.org/TR/1999/REC-xpath-19991116</XPathVersion>
</PolicyDefaults>
<Rule Effect="Permit" RuleId="Rule-1">
<Target>
<AnyOf>
<AllOf>
<Match MatchId="urn:oasis:names:tc:xacml:1.0:function:integer-less-than">
<AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">10000</AttributeValue><AttributeSelector MustBePresent="false" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" Path="/client/sales/value/text()" DataType="http://www.w3.org/2001/XMLSchema#integer"/>
</Match>
</AllOf>
</AnyOf>
</Target>
</Rule>
<Rule RuleId="rule2" Effect="Deny">
<Description>Deny rule</Description>
</Rule>
</Policy>
I'm using BIML to generate a coordination package that will execute multiple SSIS packages (some parallel and some linear). (I'm using VS2012 and the SSIS project deployment model)
With the code below I can generate two dummy Execute Package Tasks:
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package ConstraintMode="Linear" AutoCreateConfigurationsType="None" ProtectionLevel="DontSaveSensitive" Name="Coordination">
<Parameters>
<Parameter Name="param1" DataType="Int64" IsRequired="true" IsSensitive="false">1</Parameter>
</Parameters>
<Tasks>
<Container Name="SEQ container" ConstraintMode="Parallel">
<Tasks>
<ExecutePackage Name="Run Package1">
<ExternalProjectPackage Package="Package1.dtsx" />
</ExecutePackage>
<ExecutePackage Name="Run Package2">
<ExternalProjectPackage Package="Package2.dtsx" />
</ExecutePackage>
</Tasks>
</Container>
</Tasks>
</Package>
</Packages>
</Biml>
BIDS Helper with generate the coordination package without any errors.
The next step in completing the coordination package is using a package parameter to control the executed packages. I don't see any way to pass the parameter "param1".
Is there any way to pass the parameter in BIML? (in the Execute SQL task I see this option, but not here)
UPDATE: There is a new version of BIDSHelper with the right support for project parameters...-> http://bidshelper.codeplex.com/releases/view/112755
Those options have been added to the latest builds of BIDSHelper, which will be shipping in the next two weeks. If you email support#varigence.com, we can send you a pre-release, if you'd like. The syntax is:
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Packages>
<Package ConstraintMode="Linear" AutoCreateConfigurationsType="None" ProtectionLevel="DontSaveSensitive" Name="Coordination">
<Parameters>
<Parameter Name="param1" DataType="Int64" IsRequired="true" IsSensitive="false">1</Parameter>
</Parameters>
<Tasks>
<Container Name="SEQ container" ConstraintMode="Parallel">
<Tasks>
<ExecutePackage Name="Run Package1">
<ExternalProjectPackage Package="Package1.dtsx" />
<ParameterBindings>
<ParameterBinding Name="Param1" VariableName="System.PackageID" />
</ParameterBindings>
</ExecutePackage>
<ExecutePackage Name="Run Package2">
<ExternalProjectPackage Package="Package2.dtsx" />
<ParameterBindings>
<ParameterBinding Name="Param1" VariableName="System.PackageID" />
</ParameterBindings>
</ExecutePackage>
</Tasks>
</Container>
</Tasks>
</Package>
</Packages>
</Biml>
Is it possible to configure Selenium to use Firefox driver and run the browser headlessly within Windows?
I am aware of other drivers working so within Windows or under Linux but not in the particular case mentioned above. Any reference information (ad-hoc ways to achieve it, limitations, etc.) to read upon is highly appreaciated.
Regards,
It is possible to run browsers (Firefox, IE, ...) via dedicated virtual desktop which supported by OS Windows. One such known helper utility for that task is Headless Selenium for Windows.
Here is the way we are running selenium using firefox driver in headless mode on windows.
Create a windows task schedule, you can either do this using the UI
http://windows.microsoft.com/en-US/windows/schedule-task#1TC=windows-7
or with a command like this :
schtasks /Create /TN Automation /TR C:\automation\automated_regression.bat /SC ONSTART /RU Administrator /RP password /F /V1
in our case, the automation is ant driven, so the automated_regression.bat has something like this
:myLoop
cd c:\automation
call ant_env.bat
call ant -f regression.xml
GOTO myLoop
where the regression.xml has a the typical junit targets of a selenium java project
<property name="main.dir" location="./selweb" />
<property name="src.dir" location="${main.dir}/src" />
<property name="lib.dir" location="${main.dir}/lib" />
<property name="build.dir" location="${main.dir}/build" />
<property name="test.report" location="${main.dir}/testreport">
</property>
<path id="build.classpath">
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${test.report}" />
</target>
<target name="make dir" depends="clean">
<mkdir dir="${build.dir}" />
<mkdir dir="${test.report}" />
</target>
<target name="compile" depends="clean, make dir">
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="true">
<classpath refid="build.classpath" />
</javac>
</target>
<target name="junit" depends="clean, make dir,compile">
<loadfile property="LATEST" srcFile="LATEST" />
<junit printsummary="no" fork="true" haltonfailure="false" dir="${main.dir}">
<classpath>
<pathelement path="${build.dir}" />
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</classpath>
<formatter type="xml" />
<batchtest todir="${test.report}">
<fileset dir="${build.dir}">
<include name="**/tests/**/*.class" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${test.report}">
<fileset dir="${test.report}">
<include name="**/*.xml"/>
</fileset>
<report format="noframes" todir="${test.report}/html" styledir="${main.dir}/style">
<param name="TITLE" expression="Selenium Test Results for build ${LATEST}"/>
</report>
<report format="frames" todir="${test.report}/html" styledir="${main.dir}/style"/>
</junitreport>
</target>
you can use a logger to record your ant runtime eg.
<record name="log\automation_${timestamp}.log" loglevel="verbose" append="false" />
using this you can follow what is going on in your headless automation.
The ' characters around the executable and arguments are
not part of the command.
[junit] Test com.yourtests ... FAILED
[junit] Implicitly adding C:\automation\dep\apache-ant-1.8.4\lib\ant-launcher.jar;C:\automation\dep\apache-ant-1.8.4\lib\ant.jar;C:\automation\dep\apache-ant-1.8.4\lib\ant-junit.jar;C:\automation\dep\apache-ant-1.8.4\lib\ant-junit4.jar to CLASSPATH
.....
'org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner'
'com.yourtests'
'filtertrace=true'
'haltOnError=false'
'haltOnFailure=false'
'showoutput=false'
'outputtoformatters=true'
'logfailedtests=true'
'logtestlistenerevents=false'
'formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,c:\automation\selweb\testreport\TEST-com.yourtests'
'crashfile=c:\automation\junitvmwatcher2114698975676150832.properties'
'propsfile=c:\automation\junit4190343520192991051.properties'
We have followed this approach and it's working, even screen shots are being taken and inserted in the ant-junit html report.
So the essence is that you need to run your selenium through windows Tasks Scheduler and it will run in headless mode. I think something similar can be done under linux using the cron, but i haven't tried it out to see if it works.