GIT commands

GIT Normal commands  ======================================================

git clone

git status
git pull
git status
git add –all
git commit -m “comments”
git push -u origin master


Branches  ======================================================

— to view what is your remote
git remote -v
git branch -r           — view remote branches
git branch -vv        — view local branches

— switch to work on develop branch
git checkout -b develop — if you want to work on a new branch this should work for you:
git pull origin develop
git status
git add –all
git commit -m “comments”
git push -u origin develop

reset =========================================
git reset       — give up all local changes

git reset –hard origin/develop    — give up all local changes hard to a branch

Not track a file =========================================
Try using this command:

git update-index –assume-unchanged FILENAME_TO_IGNORE

To reverse it (if you ever want to commit changes to it), use:

git update-index –no-assume-unchanged

Here’s how to list ‘assume unchanged’ files under current directory:

git ls-files -v | grep -E “^[a-z]”

As the -v option will use lowercase letters for ‘assume unchanged’ files.

Conflict resolve ========================================================

if conflict, then edit conflicted file content, run git add on each file to mark it as resolved.

Staging the file marks it as resolved in Git.

Docker common commands


  • Install
apt-get update
apt-get install sudo usermod -a -G docker $USER 
systemctl start docker
systemctl enable docker

then make a logoff , use groups to check you are in docker group or not:



  • build image:

create a Dockerfile file and then run

docker build -t your_image .

list images and containers

docker images docker images-l
docker container ls --all

run a container and check the port:

docker run -d -p 8800:80 --name your_container your_image
docker port your_container

detached run the image as a container and map the 8800 port of the container to host 80 port

Then we can check that the new container with name  based on ‘nginx_image’ is running, List the running containers:

docker ps

Or check all containers

docker ps -a
docker stop your_container
docker rm your_container
docker rmi your_image
Pull an image from a registry
docker pull alpine:3.4
Retag a local image with a new image name and tag
docker tag alpine:3.4 myrepo/myalpine:3.4
Log in to a registry (the Docker Hub by default)
docker login
Push an image to a registry
docker push myrepo/myalpine:3.4
Stop a running container through SIGTERM
docker stop my_container
Stop a running container through SIGKILL
docker kill my_container
Create an overlay network and specify a subnet
docker network create --subnet --gateway -d overlay mynet
List the networks
docker network ls
Delete all running and stopped containers
docker container prune Or this command in old versions: docker rm -f $(docker ps -aq)
 docker rm 305297d7a235 ff0a5c3750b9
Create a new bash process inside the container and connect it to the terminal
docker exec -it my_container bash
Print the last 100 lines of a container’s logs
docker logs --tail 100 my_container
  • docker run – Runs a command in a new container.
    docker run hello-world
    docker run -it busybox sh


  • docker start – Starts one or more stopped containers
  • docker stop – Stops one or more running containers
  • docker build – Builds an image form a Docker file
  • docker pull – Pulls an image or a repository from a registry
docker pull busybox
docker pull ubuntu:16.04
  • docker push – Pushes an image or a repository to a registry
  • docker export – Exports a container’s filesystem as a tar archive
  • docker exec – Runs a command in a run-time container
  • docker search – Searches the Docker Hub for images
    docker search elasticsearch
    docker search mysql

    docker attach – Attaches to a running container

  • docker commit – Creates a new image from a container’s changes
  • Watch the log
docker container logs my_container

Swagger for Spring Boot How To

This is the note about how to make the swagger work together with Spring Boot. Swagger here is used as great tool to automatically create the Restful API html docs and testing API web UI.

1. Add swagger2 and UI to POM.XML



2. Create a class for spring boot configuration for swagger:

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import static;

public class SwaggerConfig {

 public Docket productApi() {
 return new Docket(DocumentationType.SWAGGER_2).select()

private ApiInfo metaInfo() {

ApiInfo apiInfo = new ApiInfo("WayneShare RestfulAPI", "Enable knowledge sharing ...", "1.0",
 "Terms of Service", new Contact("WayneShare", "", ""),
 "", "");

return apiInfo;

3. Then you can start run the application and goes to this URL http://localhost:8080/swagger-ui.html

You will see the swagger API html docs and can test over there.

4.  Try to change this part of code in config to see changes on the UI, then you will know the meta data reflecting on UI.

ApiInfo apiInfo = new ApiInfo("WayneShare RestfulAPI", "Enable knowledge sharing ...", "1.0",
 "Terms of Service", new Contact("WayneShare", "", ""),
 "", "");

5. If you want to change the grouping name and description for one controller, then use @Api for you controller:

@Api(tags = "API 02", description = "Account info management")
public class AccountController {

6. Check these annotations too in case you want to change some meta on UI  and even the http return code desc. @ApiModelProperty @ApiOperation @ApiResponses

@ApiOperation(value = "Returns Authentication Result")
 @ApiResponses(value = { @ApiResponse(code = 200, message = "Successful Authentication") })

7. You can also run the testing for each API. Here is the final result I have done for a sample project:

Screenshot from 2018-04-27 10-41-10

Enjoy it and credit goes two these two links

Jenkins Setup in 20 minitues

Feb 2016, By WZh

This some Jenkins key points to note down:

1. Get the jenkin war file from Install the tomcat server, to run in linux.

3. Copy the jenkins.war file to the webapp folder of the tomcat, restart tomcat.

then you can access this URL to access jenkins:


4. At this step, you are still using anonymous user to access jenkins.

5. jenkin will using a default folder to save all jenkins related data files into it.

You can change to other folder as you want , eg. /opt/jenkins

6. Go to “Manage Jenkins”–>”Configure System” to do basic config for a jenkins, major points:

1. JDK Name and JAVA_HOME  , or you can let jenkins to install the JDK automatically

2. ANT  refer to your ANT or let jenkins to install one for you.

3. MAVEN refer to your ANT or let jenkins to install one for you.

4. jenkins URL:

5. CVS or Subversion; if you use Subversion, you just need to select one version here. later in each job, you input svn URL and user accounts

just save it.

7. Create job and run job according your schedule:


1. “default” when you first time using ANT/Maven will cause issue when they are auto installer. S better to refer to the specific version for them.

2. Build periodically will use cron format, do a bit study for it.

If you want every five minitues:      */5 * * * *

If you want every one hour:         H */1 * * *

8. Maven project in you eclipse will be easily run in jenkin.

9. ANT project sometimes need to test and make the build.xml working fine both at eclipse and also the jenkins environment, and you may need to add change abit your ant xml.

10. use “Manage Jenkins”–>”Configure Global Security” to enable the security , normally will use the :

1. “Jenkins’ own user database” unless you intergrate with enterprise AD/LDAP

2. “Matrix-based security” to let each user be controlled.

MAVEN basics

Installing Apache Maven

The installation of Apache Maven is a simple process of extracting the archive and adding the bin folder with the mvn command to the PATH.

Detailed steps are:

JAVA_HOME environment variable is set and points to your JDK installation


Add the bin directory of the created directory apache-maven-3.3.3 to the PATH environment variable,change your file of /etc/profile to add :

        export PATH=/opt/apache-maven-3.3.3/bin:$PATH

and also run this command too, then run this command to confirm installed in a new console
        mvn -v

create a sample project and to learn it

    cd /temp

    mvn archetype:generate -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
cd my-app
mvn package
java -cp target/my-app-1.0-SNAPSHOT.jar

Although hardly a comprehensive list, these are the most common default lifecycle phases executed.

  • validate: validate the project is correct and all necessary information is available
  • compile: compile the source code of the project
  • test: test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed
  • package: take the compiled code and package it in its distributable format, such as a JAR.
  • integration-test: process and deploy the package if necessary into an environment where integration tests can be run
  • verify: run any checks to verify the package is valid and meets quality criteria
  • install: install the package into the local repository, for use as a dependency in other projects locally
  • deploy: done in an integration or release environment, copies the final package to the remote repository for sharing with other developers and projects.

There are two other Maven lifecycles of note beyond the default list above. They are

  • clean: cleans up artifacts created by prior builds
  • site: generates site documentation for this project

This is a very simple POM but still displays the key elements every POM contains, so let’s walk through each of them to familiarize you with the POM essentials:

  • project This is the top-level element in all Maven pom.xml files.
  • modelVersion This element indicates what version of the object model this POM is using. The version of the model itself changes very infrequently but it is mandatory in order to ensure stability of use if and when the Maven developers deem it necessary to change the model.
  • groupId This element indicates the unique identifier of the organization or group that created the project. The groupId is one of the key identifiers of a project and is typically based on the fully qualified domain name of your organization. For example org.apache.maven.plugins is the designated groupId for all Maven plug-ins.
  • artifactId This element indicates the unique base name of the primary artifact being generated by this project. The primary artifact for a project is typically a JAR file. Secondary artifacts like source bundles also use the artifactId as part of their final name. A typical artifact produced by Maven would have the form <artifactId>-<version>.<extension> (for example, myapp-1.0.jar).
  • packaging This element indicates the package type to be used by this artifact (e.g. JAR, WAR, EAR, etc.). This not only means if the artifact produced is JAR, WAR, or EAR but can also indicate a specific lifecycle to use as part of the build process. (The lifecycle is a topic we will deal with further on in the guide. For now, just keep in mind that the indicated packaging of a project can play a part in customizing the build lifecycle.) The default value for the packaging element is JAR so you do not have to specify this for most projects.
  • version This element indicates the version of the artifact generated by the project. Maven goes a long way to help you with version management and you will often see the SNAPSHOT designator in a version, which indicates that a project is in a state of development. We will discuss the use of snapshots and how they work further on in this guide.
  • name This element indicates the display name used for the project. This is often used in Maven’s generated documentation.
  • url This element indicates where the project’s site can be found. This is often used in Maven’s generated documentation.
  • description This element provides a basic description of your project. This is often used in Maven’s generated documentation.
With this information about a dependency, Maven will be able to 
reference the dependency when it builds the project. Where does Maven 
reference the dependency from? Maven looks in your local repository (~/.m2/repository is the default location) to find all dependencies. 

What about dependencies built somewhere else? How do they get into my 
local repository? Whenever a project references a dependency that isn't 
available in the local repository, Maven will download the dependency 
from a remote repository into the local repository. 

Let’s add another dependency to our project. Let’s say we’ve added some logging to the code and need to add log4j as a dependency. First, we need to know what the groupId, artifactId, and version are for log4j. We can browse ibiblio and look for it, or use Google to help by searching for “ maven2 log4j”.

The search shows a directory called /maven2/log4j/log4j (or /pub/packages/maven2/log4j/log4j). In that directory is a file called maven-metadata.xml. Here’s what the maven-metadata.xml for log4j looks like:

    1. <metadata>


  • <groupId>log4j</groupId>
  • <artifactId>log4j</artifactId>
  • <version>1.1.3</version>
  • <versioning>
  • <versions>
  • <version>1.1.3</version>
  • <version>1.2.4</version>
  • <version>1.2.5</version>
  • <version>1.2.6</version>
  • <version>1.2.7</version>
  • <version>1.2.8</version>
  • <version>1.2.11</version>
  • <version>1.2.9</version>
  • <version>1.2.12</version>
  • </versions>
  • </versioning>
  • </metadata>

Tips for load test by using Visual Studio 2012 Ultimate

Tips for load test by using Visual Studio 2012 Ultimate


Have some time to use the visual studio 2012 ultimate edition for load test recently.  So there is some basic tips about this.

1.      Only the ultimate edition VS 2012 has the web performance and load test ability.
Trial version VS 2012 only support Max 25 user load.
You must install all the VS update for the load test. As first version VS 2012 has many bugs in testing. Current latest UP is 3.

2.      You can follow the walk through of the Microsoft to step by step create the web test and load test.  This is fast and best way to start learn recording and concepts.

And I have some tips can make you understand advanced load test skills quickly:


How to deploy test used resources files for the file test?

Such as you want test upload file feature , so you need source file to use,  when the web test is recorded, web test will not use the source folder of yours anymore. So you have to put the source file into the deploy folder of your test project. What you need to do is to add the folder or files into your project, by add files from “local.testsettings”—deploy, you can realize this.


How to make the web site host URL as the parameter input for web test?

There is feature called “Parameterize Web Servers” feature in the web test, can auto extract the site host name and port number from the requests. This can save the time if you want switch your test from a UAT server to a production server.   What you to do is just modify the “WebServer1” and other  parameters to change the host name.

How switch test from a http site to a https site?

If your target has enable the https, but all site content are same. What you need to do is change the “Parameterize Web Servers” data to make it as https, you do not need to re-record all your request.

What you need to do from a web test to a load test?

1.      Your web test may run fine if you just run once every time, but start to run it as the load test may get issues as concurrent user will cause the conflicts if user conflict at the features, such as check in and check out same file, rename/delete same file etc.

2.      A load test recorded by default will create random unique resource names, such as you upload a file, load test will create unique file name for you at the upload request. Open your request and check the  file name , under the properties, there is some thing called “Generate Unique Name” to control whether or not create unique name for each request.

3.      After you have the web test, and you prepare the data source csv file already, then add/create DS into your test project, you can use the DS data in your load test to let test use the file name from the DS. By this format{{}}, what you need to do is to go through each request data to check if any thing can be changed/inserted by the DS data, by this way you can create a mean full load test. Such as each user load create separate file/ rename/delete/check in /check out separate file. File named is dynamic defined from DS csv file: this will avoid load test failed by conflicts.

4.      In load test, there is some thing important, one is the “load pattern”, you need to understand “constant load ” and “step load” pattern, it will be very useful. And under the “Running Setting” , the “Run Duration” and “Test Iteration” is very important.  Iteration here mean run once the web test, when a load test start to run, each user load will run the iteration again and again, unless  the Max Test iteration reached or time duration is reached. This is basic idea of the load test works.


Data drive test by data source – how to create a csv file and use it as data source for your test request?

You can create a Data source into your test project by a CSV file:

username, password
user1, password1
user2, password2
user3, password3
user4, password4
user5, password5

then you can use the data by binding call, {{ UserDS.UserNameFile#csv.username}} in the request data input. Check each request data and web server XML input to make sure the data is changed upon your needs.

Data source access methods explaination

How to create different user account from a data source (csv file) to log in to the page?

You can create a csv file with user name and password inside, and use it in the web test as the Data source, to load test will auto log in with these users during the test, please note this does not means the “user load” in the test. Even you only has one user account , user load still can simulate hundreds concurrent user load for you in test.

How to create a plugin to do each user use each row from DS?

how to create a plug in

Difference between the concurrent users load and VS multiple account?

how to debug a web test


How to install test controller and agent

If one test client is not enough, you can install the controller and agent to make several client PC to make the test.



shortbut key for Jdev IDE

  1. Go to file in navigator : Alt+Home
  2. Find Usages Ctrl+Alt+U
  3. Go To Java Type Ctrl+Minus
  4. Go To File Ctrl+Alt+Minus
  5. Show Overview Ctrl+Shift+ Back Quote
  6. Extract Method Ctrl+Alt+X
  7. Introduce Variable Ctrl+Alt+V
  8. Run Project F11
  9. Debug Project Shift+F9
  10. Quick JavaDoc Ctrl+D
  11. Reformat Ctrl+Alt+L
  • Search
  • Code Highlight Ctrl+Alt+H
  • Clear Code Highlight Ctrl+Alt+K
  • Auto Code Highlight (this makes the code always highlighted)
  • View
  • Structure Ctrl+Shift+S
  • Property Inspector Ctrl+Shift+I
  • Component Palette Ctrl+Shift+R
  • Break Point Ctrl+Shift+R
  • Miscellaneous
  • Copy Path Ctrl+Shift+C
  • Go To Line Ctrl+G
  • Go To Window Ctrl+F6
  • Go To File Ctrl+Alt+Minus
  • Build
  • Make Project Ctrl+F9
  • Rebuild Project Alt+F9
  • Run
  • Resume F9
  • Step Over F8
  • Step Into F7
  • Step Out Shift+F7
  • Java Editing
  • Organize Imports Ctrl+Alt+O
  • Select in Navigator Alt+Home

QuickTest Professional


i am just doc this tool here as it might be used any project for UI testing. Beside the Selenium, this is a web UI automation testing tools developed by HP but widely used in the Oracle ADF project testing.

Because it can support the add-in extension, it supplies a lot ability to test the advance web UI by JAVA and .NET. And test script can make you do the function and regression test.





By W.ZH, Aug 2011

SmartCVS is the best CVS Client I have ever used, Comparing with others like WinCVS, TortoiseCVS, I have used for long time, SmartCVS has a lot improves:

1. It can crosss the OS, I am using linux version and it is quick fast, and easy to use .

2. It can list all the folder/projects in your CVS root, so you know what folders in remote site easily.

3. It can sort to show what the new file, what is the non-CVS files, so you can easily check what should be check in or commit , far better than wincvs.

4. It automatically creates folders for you for new added files, you do not need to manully add your new folders like in wincvs.

5. It automatically chooses txt or bin for your file, more intellegient.

java.lang.NoClassDefFoundError: org/apache/cactus/ServletTestCase

By W.ZH Dec 28 2010



When I try to run my test case through servlet of ServletTestRunner from the cactus’s war file. i face this exception:

java.lang.NoClassDefFoundError: org/apache/cactus/ServletTestCase


In fact it is very hard to find the reason fro this kind of things. We should explain how this cactus runs by class loader, then you can know what may cause this:

WEB-INF/classes CL --> WEB-INF/lib CL --> system CL

You see, the cactus WEB-INF/classes in fact should contain your test cases classes, those u write to inherit the ServletTestCase.

and all cactus related jar should be put into the WEB-INF/lib.

to make your test cases can run,you normally also has alot other jars put into the ear file top layer, bu they are outside the WEB-INF.

So there are three place u need to check:

1. WEB-INF/classes has all the test cases class.

2. WEB-INF/lib has all the test case support jar lib files.

3. Your top layer(outside the WEB-INF), do not has any test cases class. You may need to unzip all your jars to look for them.

What error I made is N0. 3!

like this :


After u find the reason, I think you know how to fix this error!