Posts

Showing posts from June, 2017

Sikuli Automation Suite

Image
Sikuli a GUI based automation tool http://www.sikuli.org/ It can really automate what you can see on your screen. Example to open a browser and search in google a traditional example but this any web Automation does. What more it can do is the real interesting question that we can see. It can automate any software which regular web automation tool does not cover like selenium  and other automation tool eg QTP. Sikuli what programming language it runs an interesting question.  It core scripts are written in Python. So Next Big question comes to us should we learn python. I got some answer which sound logical to me after tying the Scripts. What Effective Python Programming you need to know for using in Sikuli Scripts Python on Sikuli Control Statements For File accessing Data set accessing ( You can create you data set for your test suite in CSV and use python to parse through) No Python Knowledge needed for using the IDE as given below Sikuli IDE provide...

Simple Excel to Test your Web API Testing Automation and Regression

Image
Excel macro we use the HTTP function to make call and also log the responses to the Excel. Excel can we used for Analytic and also for the Analyzing the Statistics. Macro Test Sub Test() Dim strXML, strResponse, count Set XMLHTTP = CreateObject("MSXML2.XMLHTTP")     count = Application.WorksheetFunction.count(Range("A:A")) + 3 'MsgBox (count) For i = 4 To count If Cells(i, 4) = "" Then myurl = Cells(1, 2) + Cells(i, 3) Else myurl = Cells(1, 2) + Cells(i, 3) + "?" + Cells(i, 4) End If 'MsgBox (myurl) XMLHTTP.Open Cells(i, 2), myurl, False XMLHTTP.setRequestHeader "signatureSecret", Cells(1, 4) XMLHTTP.send Cells(i, 8) = XMLHTTP.getAllResponseHeaders() Cells(i, 9) = XMLHTTP.getResponseHeader("signatureSecret") Cells(i, 6) = (XMLHTTP.responseText) Cells(i, 7) = (XMLHTTP.Status) Next i End Sub You use Excel function to Compare the Expected Result

Apache CXF Interceptor

Initialize the CXF Interceptor Main Features public class MainFeature extends AbstractFeature { @Override protected void initializeProvider(InterceptorProvider provider, Bus bus) { PhaseInterceptor<Message> interceptor = null; // Audit interceptors interceptor = new SecurityInterceptorIn (); provider.getInInterceptors().add(interceptor); provider.getInFaultInterceptors().add(interceptor);    } } CXF Interceptor Creation Extend the AbstractPhaseInterceptor public class SecurityInterceptorIn extends AbstractPhaseInterceptor<Message> { @Override public void handleMessage(Message message) throws Fault { String msg = null; String requestURL = (String) message.get(Message.REQUEST_URL);   } } Initializing the JaxRs @ApplicationPath("/fe") public class JaxRsApiApplication extends Application { @Inject private PersonServiceImpl personServiceImpl; @Override public Set<Object...

Drools Dynamically Load

Load Drool File from location Method to Dynamically Load the Drool File and create the Knowledge Base public static KnowledgeBase readKnowledgeBase(ClassLoader loader) throws Exception { KnowledgeBuilderConfiguration kBuilderConfiguration = KnowledgeBuilderFactory .newKnowledgeBuilderConfiguration(null, loader); System.out.println(kBuilderConfiguration); KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(kBuilderConfiguration); KieBaseConfiguration kbaseConfig = KnowledgeBaseFactory.newKnowledgeBaseConfiguration(null, loader); // kbuilder.add(ResourceFactory.newByteArrayResource(getRule().getBytes()), // ResourceType.DTABLE); kbuilder.add( ResourceFactory.newFileResource( "C:\\Eligibledt.xls" ), ResourceType.DTABLE); KnowledgeBuilderErrors errors = kbuilder.getErrors(); if (errors.size() > 0) { for (KnowledgeBuilderError error : errors) System.err.println(error); throw new Ill...

Drool Decision Table

Image
How to Define a Decision Table in drools Rule Set Where you import the Model Rule Table CONDITION         EXPRESSION ACTION      Perform Data

OSGI + PAX CDI + Drools + Karaf + Decision Table

Image
Decision Table You can use the Decision Table .xls instead of the ,drl file Drool file looks as below You can place this instead of the .drl file and flow the previous post to deploy the Drool in OSGI http://opensourceappexample.blogspot.ca/2017/06/osgi-pax-cdi-drools-karaf.html

OSGI + PAX CDI + Drools + Karaf

Drools Drools is a powerful rule engine. You define rules using .drl file or .xls as an decision table In this post we will see how Drool is embedded in Karaf as OSGI. Pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>com.frontend</groupId> <artifactId>frontend-parent</artifactId> <version>1.0</version> </parent> <artifactId>frontend-cmd2</artifactId> <packaging>bundle</packaging> <properties> <runtime.version>6.5.0.Final</runtime.version> <cdi.version>1.1</cdi.version> <weld.version>2.3....

PAX CDI + Interceptor

CDI Provides many features like Beans Interceptor Decorator Portable Exception Bean Proxy Interceptor     Interceptors allow you to add functionality to the business methods of a bean without modifying the bean’s method directly. The interceptor is executed before any of the business methods of the bean. Interceptors are defined as part of the Enterprise JavaBeans specification, which can be found at  JSR 318 Define the Binding package com.rest.interceptor; import static java.lang.annotation.ElementType.METHOD; import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; import java.lang.annotation.Retention; import java.lang.annotation.Target; import javax.interceptor.InterceptorBinding; @InterceptorBinding @Target({ TYPE, METHOD }) @Retention(RUNTIME) public @interface Log { } Mark the interceptor implementation package com.rest.interceptor; impor...

Apache KARAF + PAX CDI TOC

Apache KARAF + PAX CDI TOC Links to All the Apache Karaf  POST   OSGI Service   OSGI Command to Consume the OSGI Service   CXF + JaxRS + CDI to Consume the OSGI Service using  cxf-jaxrs-integration   PAX-CDI + Interceptor OSGI + PAX-CDI + Drool + Karaf OSGI  + PAX-CDI + Drool + Karaf + Decision Table

Apache CXF CDI in Karaf (Using CXF and CDI 1.1 (JSR-346))

Image
Apache CXF CDI + Apache Karaf We are going to follow the following specs to create CXF application in Karaf Jaxrs Spec -  JSR-339 CDI 1.1 (JSR-346) Create an Rest API and Implement the Rest Service Provider for the Same.  Expose the feature with feature:install cxf-jaxrs-cdi supported in Apache Karaf. osgi-example-rest.api  Rest Api will  Pom.xml <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>osgi.example</groupId> <artifactId>osgi-example-rest</artifactId> <version>1.0</version> </parent> <artifactId>osgi-example-rest.api</artifactId> <packaging>bundl...