неділя, 15 лютого 2015 р.

How to install TestNG

1. Open Eclipse
2. Help > Install New Software...
3. Add http://beust.com/eclipse repository and complete the proccess

What is Maven

Maven is a framework for automation build project.
All the information about the project is in the pom.xml file.

Pom file consist from project properties and dependencies


Maven Lifecycle:

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.
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
Clean - clear any compiled files you have, making sure that you're really compiling each module from scratch.



How to install Maven plugin for Eclipse

1. open Eclipse
2. go to Help/Install new software...
3. click Add...
4. type Maven in Name and http://download.eclipse.org/technology/m2e/releases in Location
5. uncheck Hide items which are already installed
6. click Next

Create the project:

1. Select the option “New” -> “Project…” from the menu “File”
2. Select the “Maven Project” type
3. If it is desired, change the default location and the working set for the new project
4. Select the desired archetype. (e.g. maven-archetytpe-quickstart)
5. Define the project parameters
Project Parameters:
Group Id : Name of the group of projects. Can be related to the company or application name. Ideally, must be unique (worldwide).
Artifact Id : Name of the component or application (project)
Version : Identifier for the version of the component. You can define different versions  for the same component.
Package Name : Name of the java package where the initial source code will be generated.

How to install Maven

1. go to http://maven.apache.org/download.cgi
2. download apache-maven-3.2.5-bin.zip
3. unzip the archive to the C:\Program Files\Apache Software Foundation
4. go to Computer/Properties/Advanced system settings/Advanced/Environment variables
5. in User variables for test add new Variable Name M2_HOME with Variable value C:\Program Files\Apache Software Foundation\apache-maven-3.2.5
6.  in User variables for test add new Variable Name M2 with Variable value %M2_HOME%\bin
7.  in User variables for test edit Path by adding %M2_HOME%\bin
8. in cmd run command mvn --version

середа, 4 лютого 2015 р.

понеділок, 2 лютого 2015 р.

Java: Annotation

Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate.

Java: Nested classes

In Java there inner classes and nested classes. Here we will talk about nested classes.

Java: Array

Array is an object

Java Dictionary example

The Java Dictionary class is an abstract class that allows all its derived classes to store data in the form of key-value pairs. Both keys and values can be objects of any type, but keys should be unique. Also, both keys and values cannot be null. For instance, if a key or value is referring to null and then inserted into a dictionary, a NullPointerException error occurs. Therefore, it’s mandatory to provide a non-null value for storing both keys and values.

Java: List

How to use List:

Java:Collection

Collection/container:

Java: Generics

Let's imagine that we dont't know anything about Generics.