Wednesday, March 14, 2018

Spring Boot - Redirect ?wsdl to .wsdl

1. Create urlrewrite.xml under: /src/main/resources

<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE urlrewrite
        PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
        "http://www.tuckey.org/res/dtds/urlrewrite3.0.dtd">

<urlrewrite>

    <rule>
        <from>/ws/services?wsdl</from>
        <to>/ws/services.wsdl</to>
    </rule>

</urlrewrite>

2. Add to your @Configuration file.

 @Bean
    public FilterRegistrationBean tuckeyRegistrationBean() {
        final FilterRegistrationBean registrationBean = new FilterRegistrationBean();

        registrationBean.setFilter(new UrlRewriteFilter());
        registrationBean.addInitParameter("confPath", "urlrewrite.xml");

        return registrationBean;
    }



3. Run the application and test it works bu accessing: 
http://localhost:8080/rewrite-status

Tuesday, February 6, 2018

Selenium - debug your tests in docker container

Do you have UI selenium tests running in a docker container? And if something fails, how easy it is to find the problem?

Here is something that works nicely:

1. I am using VirtualBox and I have an Ubuntu Linux machine with UI with docker and docker-compose installed.
2. Create a docker-compose.yml file:

version: '2'
services:
  hub:
    image: selenium/hub:3.8.1
    ports:
      - "4444:4444"

  firefox:
    image: selenium/node-firefox-debug:3.8.1
    volumes:
      - /dev/shm:/dev/shm
    privileged: true
    dns:
      - <your dns IP>
    environment:
      - TZ=DE
      - HUB_PORT_4444_TCP_ADDR=hub
      - HUB_PORT_4444_TCP_PORT=4444
    depends_on:
      - hub
    ports:

      - 5900

3. Open a terminal at the location of your docker-compose.yml file and deploy the selenium hub and firefox node locally, using following command:
docker-compose up


4. Check the Selenium hub and the Firefox node have started:
docker ps -a


5. Go to the VirtualBox VM Settings -> Network -> Advanced -> Port Forwarding -> and create a new rule so that you can access the container ports highlighted in green in previous image ()both Firefox node and Selenium Hub.


6. Install VNC Viewer:

7. Go to Chrome apps and start it: chrome://apps/

8. Enter localhost:5900 -> Connect -> Password is: secret


9. Here is your container.


10. Last thing you have to do is add this line to your testng.xml (I am using testng). On your local machine project in IntelliJ.

<parameter name="hubUrl" value="http://localhost:4444/wd/hub"/>


From here on you can run and debug your tests inside a local container and see what is happening.

I got this hint from a colleague and it was really helpful. I hope it helps you too :)

Sunday, January 28, 2018

"gem install jekyll" fails on Windows 10


Getting this error when trying to install jekyll on Windows?

gem install jekyll
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

Here is a solution that worked for me:

1. Download Ruby 2.3 (not going to work with higher version) according to your OS architecture 32 or 64 bit.
https://rubyinstaller.org/downloads/

2. Run the installer to install ruby. After the installer finishes you will have something like this: C:\Ruby23-x64
You can also check the installation by opening a cammand prompt window and typing:

ruby -v

3. From the same site download DevKit.
4. Double-click on the DevKit archive and extract it to something like C:\DevKit.

5. Open a command prompt and navigate to C:\DevKit.

6. Check your C:\DevKit\config.yml file contains reference to your ruby installation.


7. Run ruby dk.rb init followed by ruby dk.rb install

8. Test DevKit installation by running:
gem install json --platform=ruby. JSON 

should install correctly and you should see with native extensions in the screen messages.
Next run
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"
to confirm that the json gem is working

9. Install jekyll:
gem install jekyll

10. test jekyll installation:
jekyll -v

Source: https://davesquared.net/2010/08/building-native-extensions-for-ruby.html

Wednesday, January 24, 2018

Find out linux version and x32 or x64

linux version:
lsb_release -a

architecture:
uname -m

where:
i686 = 32 bit
x86_64 = 64 bit