Sunday, November 17, 2019

Docker Compose Getting Started with JAVA RocketMQ


Motivation

Just want to try Docker Compose...

Prerequisites

Install Docker Compose on Ubuntu 18.04
https://ben-bai.blogspot.com/2019/11/install-docker-compose-on-ubuntu-1804.html

JAVA JMS: RocketMQ NameServer Broker Cluster
https://ben-bai.blogspot.com/2019/10/java-jms-rocketmq-nameserver-broker.html


Simple Note

Go to Dockerfile folder,

Add the docker-compose.yml below into it
https://github.com/benbai123/JSP_Servlet_Practice/blob/master/Practice/JAVA/JMS/RocketMQ/RocketMQCluster/docker-compose.yml

then run docker-compose up

Docker Compose will build image and run container with specified config value

Testing Video
https://youtu.be/QHQEacrtU9k

Shortly,

Dockerfile define "how to create the container"

docker-compose.yml describe "how to config/run containers"


References

Get started with Docker Compose
https://docs.docker.com/compose/gettingstarted/

Compose file version 3 reference
https://docs.docker.com/compose/compose-file/

Thursday, November 14, 2019

Install Docker Compose on Ubuntu 18.04


Simple Note

Just several lines of commands

# Run this command to download the current stable release of Docker Compose
# To install a different version of Compose, substitute 1.24.1 with the version of Compose you want to use.
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose

# Test the installation.
docker-compose --version

# done


Reference

Install Docker Compose

Tuesday, November 12, 2019

JAVA Selenium Visual Testing


Motivation

Visual Testing is convenient, let you find any change of a web page in one line.

Prerequisites

You probably will want to view the articles in this blog below before reading this article

JAVA Selenium Browser Automation Getting Started

JAVA Selenium Commands Testing

JAVA Image Basic Operations

Java Diff Image and Highlight Differences

Simple Note

Testing file VisualTessting.java

Visual Testing Implementation VisualTestingImpl.java

After the testing file is executed, you should find some images in the folder selenium/visualTesting/123456 under your project folder.

References

Converting BufferedImage to ByteBuffer

How to make a hashcode(integer value) positive

How to take Re-entrant lock on String value?

Thursday, November 7, 2019

Java Diff Image and Highlight Differences


Motivation

I want to implement visual testing with Selenium.

There is already a library romankh3/image-comparison

but it says "with the same sizes" so probably not suitable in some cases.

Simple Note

Test file ImageDiff.java

Diff implementation ImageDiffImpl.java

Assume expected image aa.png and actual image cc.png
the diff result will be output_image.png

References

How do you clone a BufferedImage

calculating distance between a point and a rectangular box

Filling a Multidimensional Array using a Stream


Sunday, November 3, 2019

JAVA Image Basic Operations


Motivation

I want to implement visual testing with Selenium screenshot so need to know basic operations of Image in JAVA.

Simple Note

Testing file TestBasicOperations.java
Including read image file, get information of each pixel, draw rectangle on loaded image then save it.

Pixel class Pixel.java
for store information of each pixel

References

Java - get pixel array from image

Java 8: Replace traditional for loops with IntStreams