languages = Arrays.asList("Java", "C#", "Python", "PHP");
13 |
14 | for (String l : languages) {
15 | System.out.println("Я хочу выучить " + l);
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/Equality.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | public class Equality {
4 |
5 | public static void main(String[] args) {
6 | String s1 = "firefox 2.0";
7 | String s2 = "firefox " + Math.sqrt(4.0);
8 |
9 | System.out.println(s1 == s2);
10 | System.out.println(s1.equals(s2));
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/Equation.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | public class Equation {
4 |
5 | private double a;
6 | private double b;
7 | private double c;
8 |
9 | private int n;
10 |
11 | public Equation(double a, double b, double c) {
12 | this.a = a;
13 | this.b = b;
14 | this.c = c;
15 |
16 | double d = b*b - 4*a*c;
17 |
18 | if (a != 0) {
19 | if (d > 0) {
20 | n = 2;
21 | } else if (d == 0) {
22 | n = 1;
23 | } else {
24 | n = 0;
25 | }
26 |
27 | } else if (b != 0) {
28 | n = 1;
29 |
30 | } else if (c != 0) {
31 | n = 0;
32 |
33 | } else {
34 | n = -1;
35 | }
36 |
37 | }
38 |
39 | public int rootNumber() {
40 | return n;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/MyFirstProgram.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | public class MyFirstProgram {
4 |
5 | public static void main(String[] args) {
6 | hello("world");
7 | hello("user");
8 | hello("Alexei");
9 |
10 | Square s = new Square(5);
11 | System.out.println("Площадь квадрата со стороной " + s.l + " = " + s.area());
12 |
13 | Rectangle r = new Rectangle(4, 6);
14 | System.out.println("Площадь прямоугольника со сторонами " + r.a + " и " + r.b + " = " + r.area());
15 | }
16 |
17 | public static void hello(String somebody) {
18 | System.out.println("Hello, " + somebody + "!");
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/Primes.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | public class Primes {
4 |
5 | public static boolean isPrime(int n) {
6 | for (int i = 2; i < n; i++) {
7 | if (n % i == 0) {
8 | return false;
9 | }
10 | }
11 | return true;
12 | }
13 |
14 | public static boolean isPrimeFast(int n) {
15 | int m = (int) Math.sqrt(n);
16 | for (int i = 2; i < m; i++) {
17 | if (n % i == 0) {
18 | return false;
19 | }
20 | }
21 | return true;
22 | }
23 |
24 | public static boolean isPrimeWhile(int n) {
25 | int i = 2;
26 | while (i < n && n % i != 0) {
27 | i++;
28 | }
29 | return i == n;
30 | }
31 |
32 | public static boolean isPrime(long n) {
33 | for (long i = 2; i < n; i++) {
34 | if (n % i == 0) {
35 | return false;
36 | }
37 | }
38 | return true;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/Rectangle.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | /**
4 | * Created by alexei on 04.01.2016.
5 | */
6 | public class Rectangle {
7 |
8 | public double a;
9 | public double b;
10 |
11 | public Rectangle(double a, double b) {
12 | this.a = a;
13 | this.b = b;
14 | }
15 |
16 | public double area() {
17 | return this.a * this.b;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/sandbox/src/main/java/ru/stqa/pft/sandbox/Square.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | /**
4 | * Created by alexei on 04.01.2016.
5 | */
6 | public class Square {
7 |
8 | public double l;
9 |
10 | public Square(double l) {
11 | this.l = l;
12 | }
13 |
14 | public double area() {
15 | return this.l * this.l;
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/sandbox/src/test/java/ru/stqa/pft/sandbox/EquationTests.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | import org.testng.Assert;
4 | import org.testng.annotations.Test;
5 |
6 | public class EquationTests {
7 |
8 | @Test
9 | public void test0() {
10 | Equation e = new Equation(1, 1, 1);
11 | Assert.assertEquals(e.rootNumber(), 0);
12 | }
13 |
14 | @Test
15 | public void test1() {
16 | Equation e = new Equation(1, 2, 1);
17 | Assert.assertEquals(e.rootNumber(), 1);
18 | }
19 |
20 | @Test
21 | public void test2() {
22 | Equation e = new Equation(1, 5, 6);
23 | Assert.assertEquals(e.rootNumber(), 2);
24 | }
25 |
26 | @Test
27 | public void testLinear() {
28 | Equation e = new Equation(0, 1, 1);
29 | Assert.assertEquals(e.rootNumber(), 1);
30 | }
31 |
32 | @Test
33 | public void testConstant() {
34 | Equation e = new Equation(0, 0, 1);
35 | Assert.assertEquals(e.rootNumber(), 0);
36 | }
37 |
38 | @Test
39 | public void testZero() {
40 | Equation e = new Equation(0, 0, 0);
41 | Assert.assertEquals(e.rootNumber(), -1);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/sandbox/src/test/java/ru/stqa/pft/sandbox/PrimeTests.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | import org.testng.Assert;
4 | import org.testng.annotations.Test;
5 |
6 | public class PrimeTests {
7 |
8 | @Test
9 | public void testPrime() {
10 | Assert.assertTrue(Primes.isPrimeFast(Integer.MAX_VALUE));
11 | }
12 |
13 | @Test(enabled = false)
14 | public void testPrimeLong() {
15 | long n = Integer.MAX_VALUE;
16 | Assert.assertTrue(Primes.isPrime(n));
17 | }
18 |
19 | @Test
20 | public void testNonPrime() {
21 | Assert.assertFalse(Primes.isPrime(Integer.MAX_VALUE - 2));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/sandbox/src/test/java/ru/stqa/pft/sandbox/SquareTests.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.sandbox;
2 |
3 | import org.testng.Assert;
4 | import org.testng.annotations.Test;
5 |
6 | /**
7 | * Created by alexei on 07.01.2016.
8 | */
9 | public class SquareTests {
10 |
11 | @Test
12 | public void testArea() {
13 | Square s = new Square(5);
14 | Assert.assertEquals(s.area(), 25.0);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/soap-sample/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'java'
2 |
3 | repositories {
4 | mavenCentral()
5 | }
6 |
7 | dependencies {
8 | compile 'org.testng:testng:6.9.10'
9 | }
10 |
11 | buildscript{
12 | repositories{
13 | jcenter()
14 | mavenCentral()
15 | }
16 | dependencies {
17 | classpath 'no.nils:wsdl2java:0.9'
18 | }
19 | }
20 | apply plugin: 'no.nils.wsdl2java'
21 |
22 | wsdl2java {
23 | generatedWsdlDir = file("src/main/java") // target directory for generated source coude
24 | wsdlDir = file("src/main/resources") // define to support incremental build
25 | wsdlsToGenerate = [ // 2d-array of wsdls and cxf-parameters
26 | ['src/main/resources/geoipservice.wsdl'],
27 | ]
28 | }
--------------------------------------------------------------------------------
/soap-sample/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/barancev/java_pft/453ff42d9a7080c4df65447cac8cd5a8ea307ce6/soap-sample/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/soap-sample/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Dec 29 13:05:34 MSK 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-bin.zip
7 |
--------------------------------------------------------------------------------
/soap-sample/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GeoIPServiceHttpGet.java:
--------------------------------------------------------------------------------
1 | package net.webservicex;
2 |
3 | import javax.jws.WebMethod;
4 | import javax.jws.WebParam;
5 | import javax.jws.WebResult;
6 | import javax.jws.WebService;
7 | import javax.jws.soap.SOAPBinding;
8 | import javax.xml.bind.annotation.XmlSeeAlso;
9 |
10 | /**
11 | * This class was generated by Apache CXF 3.1.5
12 | * 2016-03-24T16:10:03.551+03:00
13 | * Generated source version: 3.1.5
14 | *
15 | */
16 | @WebService(targetNamespace = "http://www.webservicex.net/", name = "GeoIPServiceHttpGet")
17 | @XmlSeeAlso({ObjectFactory.class})
18 | @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
19 | public interface GeoIPServiceHttpGet {
20 |
21 | /**
22 | * GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses
23 | */
24 | @WebMethod(operationName = "GetGeoIP")
25 | @WebResult(name = "GeoIP", targetNamespace = "http://www.webservicex.net/", partName = "Body")
26 | public GeoIP getGeoIP(
27 | @WebParam(partName = "IPAddress", name = "IPAddress", targetNamespace = "")
28 | java.lang.String ipAddress
29 | );
30 |
31 | /**
32 | * GeoIPService - GetGeoIPContext enables you to easily look up countries by Context
33 | */
34 | @WebMethod(operationName = "GetGeoIPContext")
35 | @WebResult(name = "GeoIP", targetNamespace = "http://www.webservicex.net/", partName = "Body")
36 | public GeoIP getGeoIPContext();
37 | }
38 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GeoIPServiceHttpPost.java:
--------------------------------------------------------------------------------
1 | package net.webservicex;
2 |
3 | import javax.jws.WebMethod;
4 | import javax.jws.WebParam;
5 | import javax.jws.WebResult;
6 | import javax.jws.WebService;
7 | import javax.jws.soap.SOAPBinding;
8 | import javax.xml.bind.annotation.XmlSeeAlso;
9 |
10 | /**
11 | * This class was generated by Apache CXF 3.1.5
12 | * 2016-03-24T16:10:03.556+03:00
13 | * Generated source version: 3.1.5
14 | *
15 | */
16 | @WebService(targetNamespace = "http://www.webservicex.net/", name = "GeoIPServiceHttpPost")
17 | @XmlSeeAlso({ObjectFactory.class})
18 | @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
19 | public interface GeoIPServiceHttpPost {
20 |
21 | /**
22 | * GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses
23 | */
24 | @WebMethod(operationName = "GetGeoIP")
25 | @WebResult(name = "GeoIP", targetNamespace = "http://www.webservicex.net/", partName = "Body")
26 | public GeoIP getGeoIP(
27 | @WebParam(partName = "IPAddress", name = "IPAddress", targetNamespace = "")
28 | java.lang.String ipAddress
29 | );
30 |
31 | /**
32 | * GeoIPService - GetGeoIPContext enables you to easily look up countries by Context
33 | */
34 | @WebMethod(operationName = "GetGeoIPContext")
35 | @WebResult(name = "GeoIP", targetNamespace = "http://www.webservicex.net/", partName = "Body")
36 | public GeoIP getGeoIPContext();
37 | }
38 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GeoIPServiceSoap.java:
--------------------------------------------------------------------------------
1 | package net.webservicex;
2 |
3 | import javax.jws.WebMethod;
4 | import javax.jws.WebParam;
5 | import javax.jws.WebResult;
6 | import javax.jws.WebService;
7 | import javax.xml.bind.annotation.XmlSeeAlso;
8 | import javax.xml.ws.RequestWrapper;
9 | import javax.xml.ws.ResponseWrapper;
10 |
11 | /**
12 | * This class was generated by Apache CXF 3.1.5
13 | * 2016-03-24T16:10:03.512+03:00
14 | * Generated source version: 3.1.5
15 | *
16 | */
17 | @WebService(targetNamespace = "http://www.webservicex.net/", name = "GeoIPServiceSoap")
18 | @XmlSeeAlso({ObjectFactory.class})
19 | public interface GeoIPServiceSoap {
20 |
21 | /**
22 | * GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses
23 | */
24 | @WebMethod(operationName = "GetGeoIP", action = "http://www.webservicex.net/GetGeoIP")
25 | @RequestWrapper(localName = "GetGeoIP", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIP")
26 | @ResponseWrapper(localName = "GetGeoIPResponse", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPResponse")
27 | @WebResult(name = "GetGeoIPResult", targetNamespace = "http://www.webservicex.net/")
28 | public net.webservicex.GeoIP getGeoIP(
29 | @WebParam(name = "IPAddress", targetNamespace = "http://www.webservicex.net/")
30 | java.lang.String ipAddress
31 | );
32 |
33 | /**
34 | * GeoIPService - GetGeoIPContext enables you to easily look up countries by Context
35 | */
36 | @WebMethod(operationName = "GetGeoIPContext", action = "http://www.webservicex.net/GetGeoIPContext")
37 | @RequestWrapper(localName = "GetGeoIPContext", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPContext")
38 | @ResponseWrapper(localName = "GetGeoIPContextResponse", targetNamespace = "http://www.webservicex.net/", className = "net.webservicex.GetGeoIPContextResponse")
39 | @WebResult(name = "GetGeoIPContextResult", targetNamespace = "http://www.webservicex.net/")
40 | public net.webservicex.GeoIP getGeoIPContext();
41 | }
42 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GetGeoIP.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlRootElement;
8 | import javax.xml.bind.annotation.XmlType;
9 |
10 |
11 | /**
12 | * Java class for anonymous complex type.
13 | *
14 | *
The following schema fragment specifies the expected content contained within this class.
15 | *
16 | *
17 | * <complexType>
18 | * <complexContent>
19 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
20 | * <sequence>
21 | * <element name="IPAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
22 | * </sequence>
23 | * </restriction>
24 | * </complexContent>
25 | * </complexType>
26 | *
27 | *
28 | *
29 | */
30 | @XmlAccessorType(XmlAccessType.FIELD)
31 | @XmlType(name = "", propOrder = {
32 | "ipAddress"
33 | })
34 | @XmlRootElement(name = "GetGeoIP")
35 | public class GetGeoIP {
36 |
37 | @XmlElement(name = "IPAddress")
38 | protected String ipAddress;
39 |
40 | /**
41 | * Gets the value of the ipAddress property.
42 | *
43 | * @return
44 | * possible object is
45 | * {@link String }
46 | *
47 | */
48 | public String getIPAddress() {
49 | return ipAddress;
50 | }
51 |
52 | /**
53 | * Sets the value of the ipAddress property.
54 | *
55 | * @param value
56 | * allowed object is
57 | * {@link String }
58 | *
59 | */
60 | public void setIPAddress(String value) {
61 | this.ipAddress = value;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GetGeoIPContext.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlRootElement;
7 | import javax.xml.bind.annotation.XmlType;
8 |
9 |
10 | /**
11 | * Java class for anonymous complex type.
12 | *
13 | *
The following schema fragment specifies the expected content contained within this class.
14 | *
15 | *
16 | * <complexType>
17 | * <complexContent>
18 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
19 | * </restriction>
20 | * </complexContent>
21 | * </complexType>
22 | *
23 | *
24 | *
25 | */
26 | @XmlAccessorType(XmlAccessType.FIELD)
27 | @XmlType(name = "")
28 | @XmlRootElement(name = "GetGeoIPContext")
29 | public class GetGeoIPContext {
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GetGeoIPContextResponse.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlRootElement;
8 | import javax.xml.bind.annotation.XmlType;
9 |
10 |
11 | /**
12 | * Java class for anonymous complex type.
13 | *
14 | *
The following schema fragment specifies the expected content contained within this class.
15 | *
16 | *
17 | * <complexType>
18 | * <complexContent>
19 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
20 | * <sequence>
21 | * <element name="GetGeoIPContextResult" type="{http://www.webservicex.net/}GeoIP" minOccurs="0"/>
22 | * </sequence>
23 | * </restriction>
24 | * </complexContent>
25 | * </complexType>
26 | *
27 | *
28 | *
29 | */
30 | @XmlAccessorType(XmlAccessType.FIELD)
31 | @XmlType(name = "", propOrder = {
32 | "getGeoIPContextResult"
33 | })
34 | @XmlRootElement(name = "GetGeoIPContextResponse")
35 | public class GetGeoIPContextResponse {
36 |
37 | @XmlElement(name = "GetGeoIPContextResult")
38 | protected GeoIP getGeoIPContextResult;
39 |
40 | /**
41 | * Gets the value of the getGeoIPContextResult property.
42 | *
43 | * @return
44 | * possible object is
45 | * {@link GeoIP }
46 | *
47 | */
48 | public GeoIP getGetGeoIPContextResult() {
49 | return getGeoIPContextResult;
50 | }
51 |
52 | /**
53 | * Sets the value of the getGeoIPContextResult property.
54 | *
55 | * @param value
56 | * allowed object is
57 | * {@link GeoIP }
58 | *
59 | */
60 | public void setGetGeoIPContextResult(GeoIP value) {
61 | this.getGeoIPContextResult = value;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/GetGeoIPResponse.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.annotation.XmlAccessType;
5 | import javax.xml.bind.annotation.XmlAccessorType;
6 | import javax.xml.bind.annotation.XmlElement;
7 | import javax.xml.bind.annotation.XmlRootElement;
8 | import javax.xml.bind.annotation.XmlType;
9 |
10 |
11 | /**
12 | * Java class for anonymous complex type.
13 | *
14 | *
The following schema fragment specifies the expected content contained within this class.
15 | *
16 | *
17 | * <complexType>
18 | * <complexContent>
19 | * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
20 | * <sequence>
21 | * <element name="GetGeoIPResult" type="{http://www.webservicex.net/}GeoIP" minOccurs="0"/>
22 | * </sequence>
23 | * </restriction>
24 | * </complexContent>
25 | * </complexType>
26 | *
27 | *
28 | *
29 | */
30 | @XmlAccessorType(XmlAccessType.FIELD)
31 | @XmlType(name = "", propOrder = {
32 | "getGeoIPResult"
33 | })
34 | @XmlRootElement(name = "GetGeoIPResponse")
35 | public class GetGeoIPResponse {
36 |
37 | @XmlElement(name = "GetGeoIPResult")
38 | protected GeoIP getGeoIPResult;
39 |
40 | /**
41 | * Gets the value of the getGeoIPResult property.
42 | *
43 | * @return
44 | * possible object is
45 | * {@link GeoIP }
46 | *
47 | */
48 | public GeoIP getGetGeoIPResult() {
49 | return getGeoIPResult;
50 | }
51 |
52 | /**
53 | * Sets the value of the getGeoIPResult property.
54 | *
55 | * @param value
56 | * allowed object is
57 | * {@link GeoIP }
58 | *
59 | */
60 | public void setGetGeoIPResult(GeoIP value) {
61 | this.getGeoIPResult = value;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/ObjectFactory.java:
--------------------------------------------------------------------------------
1 |
2 | package net.webservicex;
3 |
4 | import javax.xml.bind.JAXBElement;
5 | import javax.xml.bind.annotation.XmlElementDecl;
6 | import javax.xml.bind.annotation.XmlRegistry;
7 | import javax.xml.namespace.QName;
8 |
9 |
10 | /**
11 | * This object contains factory methods for each
12 | * Java content interface and Java element interface
13 | * generated in the net.webservicex package.
14 | * An ObjectFactory allows you to programatically
15 | * construct new instances of the Java representation
16 | * for XML content. The Java representation of XML
17 | * content can consist of schema derived interfaces
18 | * and classes representing the binding of schema
19 | * type definitions, element declarations and model
20 | * groups. Factory methods for each of these are
21 | * provided in this class.
22 | *
23 | */
24 | @XmlRegistry
25 | public class ObjectFactory {
26 |
27 | private final static QName _GeoIP_QNAME = new QName("http://www.webservicex.net/", "GeoIP");
28 |
29 | /**
30 | * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: net.webservicex
31 | *
32 | */
33 | public ObjectFactory() {
34 | }
35 |
36 | /**
37 | * Create an instance of {@link GetGeoIP }
38 | *
39 | */
40 | public GetGeoIP createGetGeoIP() {
41 | return new GetGeoIP();
42 | }
43 |
44 | /**
45 | * Create an instance of {@link GetGeoIPResponse }
46 | *
47 | */
48 | public GetGeoIPResponse createGetGeoIPResponse() {
49 | return new GetGeoIPResponse();
50 | }
51 |
52 | /**
53 | * Create an instance of {@link GeoIP }
54 | *
55 | */
56 | public GeoIP createGeoIP() {
57 | return new GeoIP();
58 | }
59 |
60 | /**
61 | * Create an instance of {@link GetGeoIPContext }
62 | *
63 | */
64 | public GetGeoIPContext createGetGeoIPContext() {
65 | return new GetGeoIPContext();
66 | }
67 |
68 | /**
69 | * Create an instance of {@link GetGeoIPContextResponse }
70 | *
71 | */
72 | public GetGeoIPContextResponse createGetGeoIPContextResponse() {
73 | return new GetGeoIPContextResponse();
74 | }
75 |
76 | /**
77 | * Create an instance of {@link JAXBElement }{@code <}{@link GeoIP }{@code >}}
78 | *
79 | */
80 | @XmlElementDecl(namespace = "http://www.webservicex.net/", name = "GeoIP")
81 | public JAXBElement createGeoIP(GeoIP value) {
82 | return new JAXBElement(_GeoIP_QNAME, GeoIP.class, null, value);
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/soap-sample/src/main/java/net/webservicex/package-info.java:
--------------------------------------------------------------------------------
1 | @javax.xml.bind.annotation.XmlSchema(namespace = "http://www.webservicex.net/", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
2 | package net.webservicex;
3 |
--------------------------------------------------------------------------------
/soap-sample/src/test/java/ru/stqa/pft/soap/GeoIpServiceTests.java:
--------------------------------------------------------------------------------
1 | package ru.stqa.pft.soap;
2 |
3 | import net.webservicex.GeoIP;
4 | import net.webservicex.GeoIPService;
5 | import org.testng.Assert;
6 | import org.testng.annotations.Test;
7 |
8 | import static org.testng.Assert.assertEquals;
9 |
10 | public class GeoIpServiceTests {
11 |
12 | @Test
13 | public void testMyIp() {
14 | GeoIP geoIP = new GeoIPService().getGeoIPServiceSoap12().getGeoIP("194.28.29.152");
15 | assertEquals(geoIP.getCountryCode(), "RUS");
16 | }
17 |
18 | @Test
19 | public void testInvalidIp() {
20 | GeoIP geoIP = new GeoIPService().getGeoIPServiceSoap12().getGeoIP("194.28.29.xxx");
21 | assertEquals(geoIP.getCountryCode(), "RUS");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------