To make Jenkins accessible from outside of the local machine without having to open ports and accessing Jenkins directly. Also if you’re planning to use SSL (which you should!) it’s much easier to do that using IIS instead of the Java tools for that if you’re more experienced in the Microsoft world than the Java one. In situations where you have existing web sites on your server, you may find it useful to run Jenkins (or the servlet container that Jenkins runs in) behind IIS, so that you can bind Jenkins to the part of a bigger website that you may have. This section discusses some of the approaches for doing this. To achieve the same we will use reverse proxy. The reverse proxy mode allows to forward traffic from IIS to another web server (Jenkins in this example) and send the responses back through IIS. This allows us to… Read more“Configuring Jenkins on Windows Server with IIS”
Author: Ourhints
How to Export Mysql database to .sql file?
Install the mysql workbench 8.0 and follow the below steps after connecting to your database Step1 : Below is the screen which you will get after connecting to your database instance. Highlighted is the schema which needs to be exported into a file (.sql file) Step2 : Click on left tab “Administration” and then select the “Data Export” Step3 : Select the database and files which you would like to export. Now select the file name and location and click Start Export
Generating the OTP in python
There are generally combination of 4 or 6 numeric digits or a 6-digit alphanumeric. random() function can be used to generate the random OTP which is predefined in random library. You can use the below code to generate the OTP in python code,
Send an email through Amazon SES programmatically from Python
Before you begin, perform the following tasks: Verify your email address with Amazon SES—Before you can send an email with Amazon SES, you must verify that you own the sender’s email address. If your account is still in the Amazon SES sandbox, you must also verify the recipient email address. The easiest way to verify email addresses is by using the Amazon SES console. For more information, see Verifying email addresses in Amazon SES https://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-email-addresses.html Get your AWS credentials—You need an AWS access key ID and AWS secret access key to access Amazon SES using an SDK. You can find your credentials by using the Security Credentials page of the AWS Management Console. For more information about credentials, see Types of Amazon SES credentials https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-concepts-credentials.html Use the below code for sending email from python code, import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText class sendemail: @staticmethod def… Read more“Send an email through Amazon SES programmatically from Python”
Using restassured to call API behind proxy
In most of the organisations we have proxies and while using restassured we face “java.net.ConnectException: Connection timed out” or “java.net.ConnectException: Connection refused” error as proxy does not allows the traffic. To resolve same we need to set the proxy settings before making the call. To do the same there are two methods – either use System.setProperty or use io.restassured.specification . While using System.setProprty again there are two ways. One is just use system proxy System.setProperty (“java.net.useSystemProxies”, “true”); Or set all properties manually as below // The hostname, or address, of the proxy server used by the HTTP protocol handler. System.setProperty(“http.proxyHost”, “myproxy.domain.com”); // The port number of the proxy server used by the HTTP protocol handler. System.setProperty(“http.proxyPort”, “8080”); // The hostname, or address, of the proxy server used by the HTTPS protocol handler. System.setProperty(“https.proxyHost”, “myproxy.domain.com”); // The port number of the proxy server used by the HTTPS protocol handler. System.setProperty(“https.proxyPort”, “443”);… Read more“Using restassured to call API behind proxy”
The import io.restassured.RestAssured cannot be resolved
While consuming restassured maven dependencies it has been observed that even after downloading the dependencies eclipse is not able to resolve io.restassured package. Maven repository (https://mvnrepository.com/artifact/io.rest-assured/rest-assured) has the scope set to test in the dependency tag. This limits your code from accessing that dependency’s classes within your source code. That is, you can access those classes only within your test sources (ex: ${project.dir}/src/test/java/, ${project.dir}/test/. Mostly that is not the intended use case, so just remove the scope attribute. <!– https://mvnrepository.com/artifact/io.rest-assured/rest-assured –> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <version>4.3.2</version> <!– <scope>test</scope> –> </dependency>
TestNG by default disables loading DTD from unsecure Urls
While executing TestNG sometime we hit below error: org.testng.TestNGException: TestNG by default disables loading DTD from unsecure Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true] at org.testng.xml.TestNGContentHandler.resolveEntity(TestNGContentHandler.java:102) This can be sol;ved using 3 ways. 1. First and ideal way is to use https url in TestNGXML.It should be like: Very first and ideal way is to use https URL in TestNG.xml file. <!DOCTYPE suite SYSTEM “https://testng.org/testng-1.0.dtd”>instead of <!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd”> Second way is to update Run Configuration and add VM argument -ea -Dtestng.dtd.http=true: 3. Third way is to update the eclipse TestNG Preferences
How to setup Selenium & Gecko driver on MAC
Step 1. Install Selenium Create a maven project and add dependency for Selenium. To get maven details open https://mvnrepository.com/search?q=selenium. This will list down all selenium related repositories. Select selenium java and select latest version. You can find the maven details like: <!– https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java –><dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version></dependency> Step 2. Install Gecko driver Download mac os specific GeckoDriver executable. This will download the tar file. unzip it to get the geckodriver unix executable. Copy this file into your project lib folder. Open the terminal and run command chmod +x gecko driver Here is sample code to test:
Database Testing using SOAPUI
Write to local file system using a postman collection
There are situations when you want to write the API response on local file system. So here I am explaining how to do that. Basically there are two ways to do it. One is by using node js scrip and another way to start a local server which accepts postman requests. Here I am explaining first method only. Ensure that you have node and npm installed. Install newman with: npm install newman. Create a file with the following contents: Here is another example:
Performance Testing
Performance testing is a form of software testing that how an application is performing in a defined environment under specified load. Performance Testing is conducted to evaluate the compliance of a system or component with specified performance requirements. It checks the response time, reliability, resource usage, scalability of a software program under their expected workload. It also used for capacity planning purposes. The purpose of Performance Testing is not to find functional defects but to eliminate performance bottlenecks in the software or device. Types of Performance Testing Load testing – Measures the application performance with different load. Target is to checks the application’s ability to perform under anticipated load in production. The objective is to identify performance bottlenecks before the software application goes live. Stress testing – Meant to measure system performance outside of the parameters of normal working conditions. It involves testing an application under extreme workloads to see… Read more“Performance Testing”
Starting with Git in simple steps
Version Control System (VCS) To understand the git first let’s understand the version control system (VCS). VCS is a system that records the changes to file or set of files over time so that one can recall specific versions later on need basis. The complete version history get stored on a centralized repository. This centralized repository can be on local machine or on any. Central VCS server. To understand let’s take example where we code is stored using VCS. If somebody wants to make a change in the code, one need to checkout the code on local. When changes are done, new version needs to be added back to VCS. There are many VCS but subversion or SVN is most popular one. Distributed Version Control System (D-VCS) Challenge comes when a large group is make simultaneous changes. To solve that Distributed version control system came. If you are familiar with… Read more“Starting with Git in simple steps”
Tips to analyse logs using unix commands
I have seen many developer struggling to analyze the logs on unix. They download the files and then open file in editors which is not efficient way to analyze the logs. Task can be achieved with much easier way using commands. First thing I advise to use bash command before starting, This was all commands will be saved in history. You can access the history of commands using “history” command. Display first 100 lines of log filehead -100 /logs/error.log Display last 100 lines of log filestail -100 /logs/error.log View growing log file in real time using tail commandtail -f /logs/error.log View growing log file in real time with last 100 linestail -100f /logs/error.log Display complete log filecat /logs/error.log Display specific lines (based on line number) of a file using head and tail command
How to access request body in postman
I have received few questions on how to access the Postman Request body in case we need to compare the request and response. So here is the quick answer, just use pm.request.body to access the request body. For example you need to save User ID in variable and the you can verify the response on the basis of user id.
How to use date and timestamp in postman
Many times we need to pass timestamp or date as request parameter. One way is to use predefined variable like {{$timestamp}}. But this can not be used when it’s needed in specific format. So to achieve that we should use ‘Pre-Request Script’ option. Use below code in pre request script. Here we are using moment class to get specific formats. Then use these environment variables as parameter like {{timestamp}} or {{date}} Another need could be to access the time in milliseconds. Add below code in ‘Pre-Request Script’ tab and in it can be accesses as variable.
Difference between Springboot 1.X and Springboot 2.X
We have been using Springboot 1.X in our applications and recently started coverting the existing code to use new springboot2.X version. Moving to Spring Boot 2.X will upgrade a number of dependencies hence some of our code needs to be changed. Below are the advantages or new features we came across, 1.Java 8 is minimum version 2.Tomcat 8.5 is minimum version 3.Hibernate 5.2 is minimum version 4.Gradle 3.4 is minimum version 5.Previously several Spring Boot starters were transitively depending on Spring MVC with spring-boot-starter-web. With the new support of Spring WebFlux, spring-boot-starter-mustache, spring-boot-starter-freemarker and spring-boot-starter-thymeleaf are not depending on it anymore. It is the developer’s responsibility to choose and add spring-boot-starter-web or spring-boot-starter-webflux. 6.Spring boot2.X initializr has dedicated auto-configuration to automatically configure the service.The behavior of the spring.config.location configuration has been fixed; it previously added a location to the list of default ones, now it replaces the default locations. If… Read more“Difference between Springboot 1.X and Springboot 2.X”
Fundamentals of Microservices Design
Define the correct microservice scope When we talk about the scope of a microservice, we are referring to the features of an independent software module. The ability of microservices to perform as a nearly-stateless system allows it to be developed independently. Create a unique service which will act as an identifying source, much like a unique key in a database table. Have loose coupling with high cohesion We should create correct API and take special care during integration. The microservices style is usually organized around business capabilities and priorities. Unlike a traditional monolithic development approach—where different teams each have a specific focus on, say, UIs, databases, technology layers, or server-side logic—microservice architecture utilizes cross-functional teams. The responsibilities of each team are to make specific products based on one or more individual services communicating via message bus. In microservices, a team owns the product for its lifetime. Restrict access to data… Read more“Fundamentals of Microservices Design”
Features of Spring Boot
What are important features of using Spring Boot?
Agile Methodology of Development
Agile is a software development methodology to build software incrementally using short iterations of 1 to 4 weeks so that the development is aligned with the changing business needs. Whereas the traditional “waterfall” approach has one discipline contribute to the project, then “throw it over the wall” to the next contributor, agile calls for collaborative cross-functional teams. Agile isn’t defined by a set of ceremonies or specific development techniques. Rather, agile is a group of methodologies that demonstrate a commitment to tight feedback cycles and continuous improvement. With Agile development methodology – In the Agile methodology, each project is broken up into several ‘Iterations’. All Iterations should be of the same time duration (between 2 to 8 weeks). At the end of each iteration a working product should be delivered. In simple terms, in the Agile approach the project will be broken up into 10 releases (assuming each iteration is set to last… Read more“Agile Methodology of Development”
How to create new laravel project ( new php application )
You need to follow the below steps for creating new laravel project ( or new php application ) Step 1: Install Composer Go to https://getcomposer.org/ and download Windows installer. Step 2: If your installation is successful, by running composer on command prompt, you will see all kinds of info just by running that command. Go to folder where you want to install the laravel. Just run below command in your command prompt: composer create-project laravel/laravel your-project-name or < you can istall Laravel globally. for this open cmd in Windows and enter this command. composer global require “laravel/installer” then run the below command for creating project laravel new your-project-name
Hystrix (Circuit Breaker )
Hystrix in spring cloud is the implementation of Circuit Breaker pattern, which gives a control over latency and failure between distributed micro services. Here main idea is to stop cascading failures by failing fast and recover as soon as possible. Netflix created Hystrix library implementing the Circuit Breaker pattern to address these kinds of issues. Step1 : Add the Hystrix starter to your spring project <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> </dependency> Step2 : Enable the Circuit Breaker by adding annotation to your project @EnableCircuitBreaker Step3 : Now we can use @HystrixCommand annotation on any method we want to apply timeout and fallback method. The fallback method should be defined in the same class and should have the same signature. public class ServiceClient { private final RestTemplate restTemplate; @Autowired public ServiceClient(RestTemplate restTemplate) { this.restTemplate = restTemplate; } @HystrixCommand(fallbackMethod =… Read more“Hystrix (Circuit Breaker )”
Feign Client
Netflix provides Feign as an abstraction over REST-based calls, by which microservices can communicate with each other, but developers don’t have to bother about REST internal details. 1.Add the feign dependency to your project e.g. <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-feign</artifactId> </dependency> 2.Tell to project that we will use Feign client, so scan its annotation, add the below annotation to your application class @EnableFeignClients 3. Now, we have to create an interface where we declare the services we want to call. Please note that Service Request mapping is same as the Actual Service Rest URL. @FeignClient(name=”MySearch” ) //Service Id of service you want to call public interface MySearchServiceProxy { – – – } 4. Add or create a Controller where we autowire our Feign Interface so Spring can Inject actual implementation during runtime. @RefreshScope @RestController public class FeignMySearchController { @Autowired MySearchServiceProxy… Read more“Feign Client”
Why Spring cloud is required?
When we develop microservices with Spring Boot , we might face the below mentioned issues hence spring cloud project helps to eliminate these issues.Spring cloud is set of tools to manage and establish the service Discovery, config management and Circuit Breakers etc. It manages and handles following very efficiently, 1. Any of the network and security issues. 2. Service discovery tools manage how processes and services in a cluster can find and talk to one another. It involves a directory of services, registering services in that directory, and then being able to lookup and connect to services in that directory. 3. Redundancy issues in distributed systems. 4. Load balancing improves the distribution of workloads across multiple computing resources, such as computers, a computer cluster, network links, central processing units, or disk drives. 5. Performance issues due to various operational overheads. 6. Requirement of deployment and continuous integration.
Is there a way to make npm commands work properly behind a proxy?
Is there a way to make NPM commands work properly behind proxy? I was trying to install the angular library using the NPM but seems due to proxy issue its not able to download from internet. Can someone please help?
How to check the apache config on ubuntu
You can run the below commands to test and check the status of apache configuration. This will list the incorrect configuration or apache config which is breaking to start the apache, Go to apache installation directory, – cd /etc/apache2 type the command – apache2ctl configtest
Installing apache, mysql and php on ubuntu
1.login using the putty to server ( You need to generate a key if using the AWS ) 2.Use the host name as ubuntu@publicip or instance name of server and select the key under auth generated from AWS 3.switch to root user by running the command sudo su 4.get the latest updates run below command sudo apt-get update 5.Installing apache sudo apt install apache2 6.Installing mysql server sudo apt-get install mysql-server 7.Installing the php (uninstall php if already installed using sudo apt-get –purge remove php*) sudo add-apt-repository ppa:ondrej/php sudo apt update sudo apt-get install php-7.0 8.Installing PHP extensions required such as MySQL,mbstring ,curl etc. sudo apt-get install php7.0-{mbstring,mcrypt,mysql,curl} i)Installing xml module used for sending emails on php sudo apt-get install php7.0-xml ii)Installing the curl for php sudo apt-get install php7.0-curl iii) Installing mcrypt module on php sudo apt-get install mcrypt php7.0-mcrypt 9.Enabling the restart on boot sudo systemctl enable apache2.service… Read more“Installing apache, mysql and php on ubuntu”
Mcrypt PHP extension required or PHP7 is missing mcrypt or PHP missing mcrypt module
Please note that higher releases of PHP ( PHP 7.1 or PHP 7.2 + ) do not support this module anymore. This has been eliminated. We need to use the php 7 if you want to use this module inside your project, follow the below steps after switching back to php 7, sudo apt-get update sudo apt-get install mcrypt php7.0-mcrypt sudo apt-get upgrade echo “extension=mcrypt.so” | sudo tee -a /etc/php/7.0/apache2/conf.d/mcrypt.ini Then restarts apache sudo service apache2 restart
JVM (Java) and it’s Memory Management
JVM (Java Virtual Machine) is an abstract machine or can say it is a software implementation of a Physical Machine. It is a specification that provides runtime environment in which java bytecode can be executed. JVMs are available for many hardware and software platforms (i.e. JVM is platform dependent). What is JVM It is: A specification: Where working of Java Virtual Machine is specified. But implementation provider is independent to choose the algorithm. Its implementation has been provided by Oracle and other companies. An implementation: Its implementation is known as JRE (Java Runtime Environment). Runtime Instance: Whenever you write java command on the command prompt to run the java class, an instance of JVM is created. What it does The JVM performs following operation: Loads code Verifies code Executes code Provides runtime environment JVM provides definitions for the: Memory area Class file format Register set Garbage-collected heap Fatal error reporting… Read more“JVM (Java) and it’s Memory Management”
Difference between Git and SVN
Version Control System A version control system (VCS) helps you to make changes in source code of the project and upload those to some central repository to keep the history of changes safe and remain available for other people of the project in order to get the updated code or merge their changes or make further changes. In simple words these are the tools which keep the history of thee source code and helps to access the history if required. These tools have their own collaboration models using which developers will share their code across teams.There are multiple such tools in market like git, svn, RTC, cleaarcase etc. This article is targeting to put down major differences between two most famous VCS tools git and SVN so it is assumed that the reader already has some familiarity with code versioning systems, the concepts of revisions. GIT Git was initially developed… Read more“Difference between Git and SVN”
REST Service
How we can design a REST service which returns both JSON and XML depending on the request header?
What is Ajax?
Ajax The term Ajax is used to describe a set of technologies that allow browsers to provide users with a more natural browsing experience. Before Ajax, Web sites forced their users into the submit/wait/reload paradigm, where the users’ actions were always synchronized with the server’s “think time. “Ajax provides the ability to communicate with the server asynchronously, thereby freeing the user experience from the request/response cycle. With Ajax, when a user clicks a button, you can use JavaScript and DHTML to immediately update the UI, and spawn an asynchronous request to the server to perform an update or query a database. When the request returns, you can then use JavaScript and CSS to update your UI accordingly without refreshing the entire page. Most importantly, users don’t even know your code is communicating with the server: the Web site feels like it’s instantly responding. AJAX is not a new technology. It… Read more“What is Ajax?”
Java OOPs
What are the principle concepts of OOPS? There are four principle concepts upon which object oriented design and programming rest. They are: Abstraction Polymorphism Inheritance Encapsulation (i.e. easily remembered as A-PIE). What is Abstraction? Abstraction refers to the act of representing essential features without including the background details or explanations. What is Encapsulation? Encapsulation is a technique used for hiding the properties and behaviors of an object and allowing outside access only as appropriate. It prevents other objects from directly altering or accessing the properties or methods of the encapsulated object. What is the difference between abstraction and encapsulation? Abstraction focuses on the outside view of an object (i.e. the interface) Encapsulation (information hiding) prevents clients from seeing it’s inside view, where the behavior of the abstraction is implemented. Abstraction solves the problem in the design side while Encapsulation is the Implementation. Encapsulation is the deliverables of Abstraction. Encapsulation barely… Read more“Java OOPs”
Difference between Static and Dynamic Web Content
Static contents : The contents of the Web page which do not change frequently irrespective of user who is requesting or the time at which request has been sent. Working of the Web Application (Static Contents): The user send the request by typing the specific URL in the client browser. The DNS server resolves the URL to the IP address and return’s it to requesting browser. The browser then send the request to the Server with IP address as obtained above The Web Server will be listening in to the requests at Port No 80 The browser connects to Port No 80 of the specified Server Since the user is requesting for the static contents, Web server retrieve a file (normally html) and sends it to the requesting client browser as a response. The client has to wait till the response has not been received. Dynamic Contents : The contents… Read more“Difference between Static and Dynamic Web Content”
How to paste lotus notes link into outlook email
These days many companies switching from lotus notes to Outlook and so we get frequently need to paste notes link into outlook email. In this article I’ll be explaining how to create custom button which can paste lotus notes link into outlook email. You can download vba project VbaProject. Extract VbaProject.OTM at C:\Users\<User>\AppData\Roaming\Microsoft\Outlook or alternatively follow below steps to create the vba project. Open outlook and hit Alt+F11. This will open vba developer window. Create a new module and add below code: Sub New_Paste_Link() Dim strLink As String Dim doLink As DataObject Dim strLinkName As String Dim intStart As Long Set doLink = New DataObject doLink.GetFromClipboard ‘MsgBox prompt:=doLink.GetText strLink = Parse_Link(doLink.GetText) If InStr(1, doLink.GetText, “<NDL>”) > 1 Then intStart = InStr(1, doLink.GetText, vbCrLf) If intStart > 1 Then strLinkName = Left(doLink.GetText, intStart – 1) Else strLinkName = “Link” End If Else strLinkName = “Link” End If strLinkName = Trim(strLinkName) If strLink > “”… Read more“How to paste lotus notes link into outlook email”
Solr index
How we can delete all documents in solr index?
Generics in Java
Generics Many algorithms work in a similar way irrespective of the data types on which they are applied on All Stacks work in a similar way irrespective of the type of object they hold Generics help to write algorithms independent of a data type These algorithms can be applied to a variety of data types The data type is parameterized A class, interface or a method that works on a parameterized type is called a generic public class List<T>{ protected T [] list; public List(T [] list){ this.list = list; } public void put(T element, int position){ list[position] = element; } public T get(int position){ return list[position]; } } In above code, T represents a data type. While declaring an object of List, the programmer can decide the actual type for T. List<String> list = new List<String>(new String[5]); list.put(“Hello”, 0); list.put(“Welcome”, 1); list.put(“Ok”, 2); System.out.println(list.get(0)); System.out.println(list.get(1)); System.out.println(list.get(2)); Just like… Read more“Generics in Java”
How to pass parameters in downstream jenkins jobs
I got a question how to pass parameter in trailing jobs. Jenkins 2.0 provides option to use Jenkinsfile. Takes in parameter “Task_Name” Runs Job-1 and pass in parameter “Task_Name” to it Upon successful run of Job-1, it will trigger Job-2 and pass in the “Task_Name” parameter Note that Job-1 and Job-2 are 2 separate Jenkins jobs, and the Jenkinsfile below belongs to the Jenkins job that triggers both Job-1 and Job-2 pipeline { agent any parameters { string(name: ‘Task_Name’, defaultValue: ‘Testing’, description: ‘Name of the task’) } stages { stage(‘job 1’){ steps { echo “${params.Task_Name} Job 1!” } } stage(‘job 2’){ steps { echo “${params.Task_Name} Job 2!” } } } }
Collection Framework in Java
The Collection Framework is a set of classes and interfaces Helps in handling groups of objects Standardizes the way in which groups of objects are handled The important interfaces of the Collection Framework are Collection List Queue Set SortedSet All these interfaces are generic interfaces Collection interface declares the methods that any Collection should have Any class that defines a Collection should implement this interface Some of the important methods are add remove contains isEmpty List List interface extends Collection interface List interface declares the behavior of a Collection that stores a sequence of elements Elements can be inserted and accessed by their position Some of the important methods are add (adds to the specified position) get (gets from the specified position) indexOf Set Set interface extends Collection interface Set interface declares the behavior of a Collection that does not allow duplicate elements Does not declare any new method on… Read more“Collection Framework in Java”
Exceptions and Errors in Java
Exception Exception is an exceptional case that can happen in a program An Exception occurs during the execution of a program and disrupts the normal flow of instructions. When there is an exception Normally the program crashes and prints a system generated error message Not acceptable in a mission critical application The programmer can handle the exception, preventing the program from crashing Exception Handler is a set of instructions that handles an exception The Java programming language provides a mechanism to help programs report and handle errors When an error occurs, the program throws an exception The exception object that is thrown contains information about the exception The runtime environment attempts to find the Exception Handler The exception handler attempts to recover from the error If the error is unrecoverable, provide a gentle exit from the program after clean up operations like closing open files etc Helpful in separating the… Read more“Exceptions and Errors in Java”
Testing SOAP Services with WS-Security using SOAPUI
Web Services Security (WSS): SOAP Message Security is a set of enhancements to SOAP messaging that provides message integrity and confidentiality. WSS: SOAP Message Security is extensible, and can accommodate a variety of security models and encryption technologies. WSS: SOAP Message Security provides three main mechanisms that can be used independently or together: The ability to send security tokens as part of a message, and for associating the security tokens with message content The ability to protect the contents of a message from unauthorized and undetected modification (message integrity) The ability to protect the contents of a message from unauthorized disclosure (message confidentiality). WSS: SOAP Message Security can be used in conjunction with other web service extensions and application-specific protocols to satisfy a variety of security requirements. In this article we will learn how to use different authentication options in SOAP UI. I’ll be using examples from test project on… Read more“Testing SOAP Services with WS-Security using SOAPUI”
Error while decryption of SOAPUI response- “Error Getting Response :null”
In SOAPUI in many cases when we apply the wss keystore for decryption it hits error and shows message: “Error Getting Response :null”. But shows nothing in SOAPUI logs and blank output screen. When you remove Incoming WSS it shows the encrypted response. To solve this you can try below steps: Go to C:\Program Files\SmartBear\SoapUI-5.3.0\lib Rename wss4j-1.6.16.jar to wss4j-1.6.16.jar.old Copy wss4j-1.6.2.jar from same location for SoapUI 4.5 to this folder. You can down load wss4j jars from : http://central.maven.org/maven2/org/apache/ws/security/wss4j/1.6.2/wss4j-1.6.2.jar Some other jar versions also may work. You may still face issue with decryption then check the logs at: C:\Program Files\SmartBear\SoapUI-5.3.0\bin\soapui.log. In case it’s showing “org.apache.xml.security.encryption.XMLEncryptionException: Illegal key size” error that suggests that JCE error due few jar files are missing from installation. This issue can be resolved by installing the Oracle® Java JCE unlimited strength jars. These jars can be downloaded from the following links depending on which Java version you are… Read more“Error while decryption of SOAPUI response- “Error Getting Response :null””
Thread and its various states in Java
What is Thread A thread is a single sequential flow of control within a program Facility to allow multiple activities within a single process Referred as lightweight process Each thread has its own program counter, stack and local variables Threads share memory, heap area, files Why to use Thread To perform asynchronous or background processing Increases the responsiveness of GUI applications Better utilization of system resources Simplify program logic when there are multiple independent entities A very good example of a multi-threaded application is game software where the GUI display, updating of scores, sound effects and timer display are happening within the same application simultaneously. Other Thread Advantages Threads are memory efficient. Many threads can be efficiently contained within a single EXE, while each process will incur the overhead of an entire EXE. Threads share a common program space, which among other things, means that messages can be passed… Read more“Thread and its various states in Java”
Difference between Abstract Class and Interface
Abstract Classes Interfaces Can have concrete methods Can have only abstract methods Can have variables Can have only static final (constant) data members Can have private and protected members All members are public by default Can be extended from one class Can be extended from any number of interfaces A class can extend only one abstract class A class can implement any number of interfaces
Anonymous Inner Class in Java
An inner class is a class defined within another class. An inner class is a non-static nested class. It has access to all of the variables and methods of its outer class. An inner class is fully within the scope of its enclosing class. An anonymous inner class is a class that is not assigned any name. It is important to note that class Inner is known only within the scope of class Outer. The Java compiler generates an error message if any code outside of class Outer attempts to instantiate class Inner. Generally, these are used whenever you need to override the method of a class or an interface. Example- public class AnonymousInnerClassDemo extends Applet { public void init() { addMouseListener(new MouseAdapter(){ public void mousePressed (MouseEvent ev) { showStatus(“Mouse Pressed !!”); } } } In this example init() method calls addMouseListener() method. Its argument is an expression that defines… Read more“Anonymous Inner Class in Java”
Newman – Command line integration with Postman
To run the test from command line window, Postman has newly npm Package (Newman). Here quick steps to start with newman: Install latest version of Node (Node.js) in the computer. Download the Windows installer from the js® web site. To see if NPM is installed, type npm -v in command prompt. In case npm is already installed and want to update (To run Newman, ensure that you have NodeJS >= v4) run following command from cmd: npm install -g npm-windows-upgrade Set the path of Node Bin Folder (ex: C:\Program Files\nodejs\node_modules\npm\bin) in the Computer path Variable. Open the cmd and type following command “npm install -g newman”. It will install Newman in the PC. Postman provides a feature to download the collection as JSON Data. Download the collection from the Postman Open the command window in the downloaded path of collection and type following Command “newman run GetBalanceService.json -r html” Observe… Read more“Newman – Command line integration with Postman”
Postman Collections and organizing test using collections
A Postman Collection allow you to group together several APIs that might be related or perhaps should be executed in a certain sequence. You can organize these requests in folders as well. Basically collections server 4 purposes: Organization of tests, Documentation, Test Suit creation, and designing conditional workflows. How to create collection Collections can be created by following two processes. One, while saving any request it shows option to create collection and/or folders. As per need one can created and organization those. Another way to create collection by using sidebar New Collection button or New Button at toolbar. While creating the collection it shows option to select authorization type, any pre-request script, any variable or any test script. Features of Collection Postman allows drag and drop feature to reorder and organize requests and folders. By using sub folders levels can be created and description can be added while will reflect… Read more“Postman Collections and organizing test using collections”
What is IOC or Dependency Injection ?
Can you please explain IOC concept?
Overriding Hosts file using Fiddler
Configure a domain name instead of localhost:8080 (server ip:port) This is similar to what we have been doing with windows Hosts file (Windows\System32\drivers\etc\hosts). Due to some limitation, in some cases you can’t specify the port number in hosts file along with the IP address to map with a DNS name and there we need to use such proxy server. Also you can achieve the same using nginx or apache. Example, localhost:8080 ourhints.com or 127.0.0.1:8080 ourhints.com You can open the fiddler and start capturing the traffic. To override hosts file, you can specify DNS mapping to an IP address as shown below or alternatively you can import hosts file. Save this configuration. # can be used to comment any line similar to Host file on window. Now open any browser and hit the url http://ourhints.com it will be routed to http://127.0.0.1:8080 or http://localhost:8080
Writing Tests in Postman
Using postman we also can write test cases or build request using java script code. This code can use dynamic parameters, variables, or pass data between different requests. It allows us to write javascript code at two events: Before request sent to server, we call it Pre-request script and can be written in Pre-request Script After response is received from request, we call it test script. It lies under Test Script Script can be written at Collection, Folder or request level so questions comes what will be order of execution. To understand that let’s see this picture: Here I am describing test cases using newer PM API (pm.* API). Though Postman still supports old postman API but we should use newer one so that in case postman deprecate old API we don’t need to invest in maintenance. In previous article I already covered logging options in Postman which can be… Read more“Writing Tests in Postman”