├── README.md ├── pom.xml └── src ├── main └── java │ └── com │ └── github │ └── yunusmete │ └── stf │ ├── api │ ├── STFService.java │ └── ServiceGenerator.java │ ├── model │ ├── App.java │ ├── Battery.java │ ├── Browser.java │ ├── Device.java │ ├── DeviceBody.java │ ├── Display.java │ ├── Network.java │ ├── Phone.java │ ├── Provider.java │ ├── Settings.java │ └── User.java │ └── rest │ ├── ClaimResponse.java │ ├── DeviceResponse.java │ ├── RemoteConnectResponse.java │ └── UserResponse.java └── test └── java ├── AppiumTest.java └── STF.java /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](https://github.com/openstf/stf/raw/master/res/common/logo/exports/STF-128.png?raw=true) 2 | 3 | ## OpenSTF Java Client 4 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.yunusmete.stf/openstf-java-client/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.yunusmete.stf/openstf-java-client/) 5 | 6 | This project is a client of OpenSTF REST API which enables controlling and managing devices in device farm from your browser. You can go and view the project from this link: https://github.com/openstf/stf 7 | 8 | You can use that client with test automation frameworks like Appium. 9 | 10 | ### Download 11 | 12 | Maven: 13 | ```xml 14 | 15 | com.github.yunusmete.stf 16 | openstf-java-client 17 | 1.0 18 | 19 | ``` 20 | 21 | Gradle: 22 | ``` 23 | compile 'com.github.yunusmete.stf:openstf-java-client:1.0' 24 | ``` 25 | 26 | Also you can download [the latest JAR][1] and add to your project. 27 | 28 | ### License [![License for Openstf-Java-Client](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) 29 | 30 | Copyright 2016 Yunus Mete, Turkey. 31 | 32 | Licensed under the Apache License, Version 2.0 (the "License"); 33 | you may not use this file except in compliance with the License. 34 | You may obtain a copy of the License at 35 | 36 | http://www.apache.org/licenses/LICENSE-2.0 37 | 38 | Unless required by applicable law or agreed to in writing, software 39 | distributed under the License is distributed on an "AS IS" BASIS, 40 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 41 | See the License for the specific language governing permissions and 42 | limitations under the License. 43 | 44 | [1]: http://repo1.maven.org/maven2/com/github/yunusmete/stf/openstf-java-client/1.0/ 45 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.github.yunusmete.stf 8 | openstf-java-client 9 | jar 10 | openstf-java-client 11 | 1.0 12 | Java Client for Open STF API 13 | https://github.com/yunusmete/openstf-java-client 14 | 15 | 16 | 17 | Apache License, Version 2.0 18 | https://www.apache.org/licenses/LICENSE-2.0 19 | 20 | 21 | 22 | 23 | 24 | Yunus Mete 25 | yunusmete32@gmail.com 26 | Netas 27 | https://www.netas.com.tr 28 | 29 | 30 | 31 | 32 | UTF-8 33 | 1.7 34 | 1.7 35 | 36 | 37 | 38 | scm:git:git@github.com/yunusmete/openstf-java-client.git 39 | scm:git:git@github.com/yunusmete/openstf-java-client.git 40 | git@github.com/yunusmete/openstf-java-client.git 41 | openstf-java-client-1.0.0 42 | 43 | 44 | 45 | 46 | com.squareup.retrofit 47 | retrofit 48 | 1.9.0 49 | 50 | 51 | com.squareup.okhttp 52 | okhttp 53 | 2.7.2 54 | 55 | 56 | io.appium 57 | java-client 58 | 4.0.0 59 | 60 | 61 | junit 62 | junit 63 | 4.12 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | org.apache.maven.plugins 72 | maven-gpg-plugin 73 | 74 | 75 | sign-artifacts 76 | verify 77 | 78 | sign 79 | 80 | 81 | 82 | 83 | 84 | 85 | org.sonatype.plugins 86 | nexus-staging-maven-plugin 87 | 1.6.3 88 | true 89 | 90 | ossrh 91 | https://oss.sonatype.org/ 92 | true 93 | 94 | 95 | 96 | 97 | org.apache.maven.plugins 98 | maven-source-plugin 99 | 100 | 101 | attach-sources 102 | 103 | jar 104 | 105 | 106 | 107 | 108 | 109 | org.apache.maven.plugins 110 | maven-javadoc-plugin 111 | 112 | 113 | attach-javadocs 114 | 115 | jar 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | ossrh 126 | https://oss.sonatype.org/content/repositories/snapshots 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/api/STFService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.api; 3 | 4 | import com.github.yunusmete.stf.model.DeviceBody; 5 | import com.github.yunusmete.stf.rest.RemoteConnectResponse; 6 | import com.github.yunusmete.stf.rest.UserResponse; 7 | import retrofit.http.*; 8 | 9 | import com.github.yunusmete.stf.rest.ClaimResponse; 10 | import com.github.yunusmete.stf.rest.DeviceResponse; 11 | 12 | /** 13 | * Created by yunusm on 07.11.2016. 14 | */ 15 | public interface STFService { 16 | 17 | // DEVICE API 18 | 19 | /** 20 | * Get list of devices 21 | * 22 | * @return list of devices 23 | */ 24 | @GET("/devices") 25 | DeviceResponse getDevices(); 26 | 27 | @GET("/devices/{serial}") 28 | DeviceResponse getDeviceBySerial(@Path("serial") String serial); 29 | 30 | // USER API 31 | @GET("/user") 32 | UserResponse getUser(); 33 | 34 | @GET("/user/devices") 35 | DeviceResponse getUserDevices(); 36 | 37 | @POST("/user/devices") 38 | ClaimResponse addDeviceToUser(@Body DeviceBody body); 39 | 40 | @DELETE("/user/devices/{serial}") 41 | ClaimResponse deleteDeviceBySerial(@Path("serial") String serial); 42 | 43 | @POST("/user/devices/{serial}/remoteConnect") 44 | RemoteConnectResponse remoteConnectDeviceBySerial(@Path("serial") String serial); 45 | 46 | @DELETE("/user/devices/{serial}/remoteConnect") 47 | RemoteConnectResponse remoteDisconnectDeviceBySerial(@Path("serial") String serial); 48 | 49 | @GET("/user/accessTokens") 50 | DeviceResponse getAccessTokens(); 51 | 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/api/ServiceGenerator.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.api; 3 | 4 | import retrofit.RequestInterceptor; 5 | import retrofit.RestAdapter; 6 | import retrofit.client.OkClient; 7 | 8 | import com.squareup.okhttp.OkHttpClient; 9 | 10 | /** 11 | * Created by yunusm on 07.11.2016. 12 | */ 13 | public class ServiceGenerator { 14 | 15 | public static String API_BASE_URL = "localhost:7100/api/v1"; 16 | 17 | private static RestAdapter.Builder builder = new RestAdapter.Builder().setEndpoint(API_BASE_URL) 18 | .setClient(new OkClient(new OkHttpClient())); 19 | 20 | public static S createService(Class serviceClass, final String baseURL, final String accessToken) { 21 | if (accessToken != null) { 22 | builder.setEndpoint(baseURL).setRequestInterceptor(new RequestInterceptor() { 23 | public void intercept(RequestFacade requestFacade) { 24 | requestFacade.addHeader("Authorization", "Bearer " + accessToken); 25 | } 26 | }); 27 | } 28 | 29 | RestAdapter adapter = builder.build(); 30 | return adapter.create(serviceClass); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/App.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import javax.annotation.Generated; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class App { 9 | 10 | @SerializedName("id") 11 | @Expose 12 | private String id; 13 | @SerializedName("name") 14 | @Expose 15 | private String name; 16 | @SerializedName("selected") 17 | @Expose 18 | private boolean selected; 19 | @SerializedName("system") 20 | @Expose 21 | private boolean system; 22 | @SerializedName("type") 23 | @Expose 24 | private String type; 25 | @SerializedName("developer") 26 | @Expose 27 | private String developer; 28 | 29 | /** 30 | * @return The id 31 | */ 32 | public String getId() { 33 | return id; 34 | } 35 | 36 | /** 37 | * @param id 38 | * The id 39 | */ 40 | public void setId(String id) { 41 | this.id = id; 42 | } 43 | 44 | /** 45 | * @return The name 46 | */ 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | /** 52 | * @param name 53 | * The name 54 | */ 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | /** 60 | * @return The selected 61 | */ 62 | public boolean isSelected() { 63 | return selected; 64 | } 65 | 66 | /** 67 | * @param selected 68 | * The selected 69 | */ 70 | public void setSelected(boolean selected) { 71 | this.selected = selected; 72 | } 73 | 74 | /** 75 | * @return The system 76 | */ 77 | public boolean isSystem() { 78 | return system; 79 | } 80 | 81 | /** 82 | * @param system 83 | * The system 84 | */ 85 | public void setSystem(boolean system) { 86 | this.system = system; 87 | } 88 | 89 | /** 90 | * @return The type 91 | */ 92 | public String getType() { 93 | return type; 94 | } 95 | 96 | /** 97 | * @param type 98 | * The type 99 | */ 100 | public void setType(String type) { 101 | this.type = type; 102 | } 103 | 104 | /** 105 | * @return The developer 106 | */ 107 | public String getDeveloper() { 108 | return developer; 109 | } 110 | 111 | /** 112 | * @param developer 113 | * The developer 114 | */ 115 | public void setDeveloper(String developer) { 116 | this.developer = developer; 117 | } 118 | 119 | @Override 120 | public String toString() { 121 | return "App{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", selected=" + selected + ", system=" + system + ", type='" + type + '\'' + ", developer='" + developer + '\'' + '}'; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Battery.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import javax.annotation.Generated; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Battery { 9 | 10 | @SerializedName("health") 11 | @Expose 12 | private String health; 13 | @SerializedName("level") 14 | @Expose 15 | private int level; 16 | @SerializedName("scale") 17 | @Expose 18 | private int scale; 19 | @SerializedName("source") 20 | @Expose 21 | private String source; 22 | @SerializedName("status") 23 | @Expose 24 | private String status; 25 | @SerializedName("temp") 26 | @Expose 27 | private double temp; 28 | @SerializedName("voltage") 29 | @Expose 30 | private double voltage; 31 | 32 | /** 33 | * @return The health 34 | */ 35 | public String getHealth() { 36 | return health; 37 | } 38 | 39 | /** 40 | * @param health 41 | * The health 42 | */ 43 | public void setHealth(String health) { 44 | this.health = health; 45 | } 46 | 47 | /** 48 | * @return The level 49 | */ 50 | public int getLevel() { 51 | return level; 52 | } 53 | 54 | /** 55 | * @param level 56 | * The level 57 | */ 58 | public void setLevel(int level) { 59 | this.level = level; 60 | } 61 | 62 | /** 63 | * @return The scale 64 | */ 65 | public int getScale() { 66 | return scale; 67 | } 68 | 69 | /** 70 | * @param scale 71 | * The scale 72 | */ 73 | public void setScale(int scale) { 74 | this.scale = scale; 75 | } 76 | 77 | /** 78 | * @return The source 79 | */ 80 | public String getSource() { 81 | return source; 82 | } 83 | 84 | /** 85 | * @param source 86 | * The source 87 | */ 88 | public void setSource(String source) { 89 | this.source = source; 90 | } 91 | 92 | /** 93 | * @return The status 94 | */ 95 | public String getStatus() { 96 | return status; 97 | } 98 | 99 | /** 100 | * @param status 101 | * The status 102 | */ 103 | public void setStatus(String status) { 104 | this.status = status; 105 | } 106 | 107 | /** 108 | * @return The temp 109 | */ 110 | public double getTemp() { 111 | return temp; 112 | } 113 | 114 | /** 115 | * @param temp 116 | * The temp 117 | */ 118 | public void setTemp(double temp) { 119 | this.temp = temp; 120 | } 121 | 122 | /** 123 | * @return The voltage 124 | */ 125 | public double getVoltage() { 126 | return voltage; 127 | } 128 | 129 | /** 130 | * @param voltage 131 | * The voltage 132 | */ 133 | public void setVoltage(double voltage) { 134 | this.voltage = voltage; 135 | } 136 | 137 | @Override 138 | public String toString() { 139 | return "Battery{" + "health='" + health + '\'' + ", level=" + level + ", scale=" + scale + ", source='" + source + '\'' + ", status='" + status + '\'' + ", temp=" + temp + ", voltage=" + voltage + '}'; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Browser.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.google.gson.annotations.Expose; 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | public class Browser { 11 | 12 | @SerializedName("apps") 13 | @Expose 14 | private List apps = new ArrayList(); 15 | @SerializedName("selected") 16 | @Expose 17 | private boolean selected; 18 | 19 | /** 20 | * @return The apps 21 | */ 22 | public List getApps() { 23 | return apps; 24 | } 25 | 26 | /** 27 | * @param apps 28 | * The apps 29 | */ 30 | public void setApps(List apps) { 31 | this.apps = apps; 32 | } 33 | 34 | /** 35 | * @return The selected 36 | */ 37 | public boolean isSelected() { 38 | return selected; 39 | } 40 | 41 | /** 42 | * @param selected 43 | * The selected 44 | */ 45 | public void setSelected(boolean selected) { 46 | this.selected = selected; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "Browser{" + "apps=" + apps + ", selected=" + selected + '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Device.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.google.gson.annotations.Expose; 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | public class Device { 11 | 12 | @SerializedName("abi") 13 | @Expose 14 | private String abi; 15 | @SerializedName("airplaneMode") 16 | @Expose 17 | private boolean airplaneMode; 18 | @SerializedName("battery") 19 | @Expose 20 | private Battery battery; 21 | @SerializedName("browser") 22 | @Expose 23 | private Browser browser; 24 | @SerializedName("channel") 25 | @Expose 26 | private String channel; 27 | @SerializedName("createdAt") 28 | @Expose 29 | private String createdAt; 30 | @SerializedName("display") 31 | @Expose 32 | private Display display; 33 | @SerializedName("manufacturer") 34 | @Expose 35 | private String manufacturer; 36 | @SerializedName("model") 37 | @Expose 38 | private String model; 39 | @SerializedName("network") 40 | @Expose 41 | private Network network; 42 | @SerializedName("operator") 43 | @Expose 44 | private String operator; 45 | @SerializedName("owner") 46 | @Expose 47 | private Object owner; 48 | @SerializedName("phone") 49 | @Expose 50 | private Phone phone; 51 | @SerializedName("platform") 52 | @Expose 53 | private String platform; 54 | @SerializedName("presenceChangedAt") 55 | @Expose 56 | private String presenceChangedAt; 57 | @SerializedName("present") 58 | @Expose 59 | private boolean present; 60 | @SerializedName("product") 61 | @Expose 62 | private String product; 63 | @SerializedName("provider") 64 | @Expose 65 | private Provider provider; 66 | @SerializedName("ready") 67 | @Expose 68 | private boolean ready; 69 | @SerializedName("remoteConnect") 70 | @Expose 71 | private boolean remoteConnect; 72 | @SerializedName("remoteConnectUrl") 73 | @Expose 74 | private Object remoteConnectUrl; 75 | @SerializedName("reverseForwards") 76 | @Expose 77 | private List reverseForwards = new ArrayList(); 78 | @SerializedName("sdk") 79 | @Expose 80 | private String sdk; 81 | @SerializedName("serial") 82 | @Expose 83 | private String serial; 84 | @SerializedName("status") 85 | @Expose 86 | private int status; 87 | @SerializedName("statusChangedAt") 88 | @Expose 89 | private String statusChangedAt; 90 | @SerializedName("version") 91 | @Expose 92 | private String version; 93 | @SerializedName("using") 94 | @Expose 95 | private boolean using; 96 | 97 | /** 98 | * @return The abi 99 | */ 100 | public String getAbi() { 101 | return abi; 102 | } 103 | 104 | /** 105 | * @param abi 106 | * The abi 107 | */ 108 | public void setAbi(String abi) { 109 | this.abi = abi; 110 | } 111 | 112 | /** 113 | * @return The airplaneMode 114 | */ 115 | public boolean isAirplaneMode() { 116 | return airplaneMode; 117 | } 118 | 119 | /** 120 | * @param airplaneMode 121 | * The airplaneMode 122 | */ 123 | public void setAirplaneMode(boolean airplaneMode) { 124 | this.airplaneMode = airplaneMode; 125 | } 126 | 127 | /** 128 | * @return The battery 129 | */ 130 | public Battery getBattery() { 131 | return battery; 132 | } 133 | 134 | /** 135 | * @param battery 136 | * The battery 137 | */ 138 | public void setBattery(Battery battery) { 139 | this.battery = battery; 140 | } 141 | 142 | /** 143 | * @return The browser 144 | */ 145 | public Browser getBrowser() { 146 | return browser; 147 | } 148 | 149 | /** 150 | * @param browser 151 | * The browser 152 | */ 153 | public void setBrowser(Browser browser) { 154 | this.browser = browser; 155 | } 156 | 157 | /** 158 | * @return The channel 159 | */ 160 | public String getChannel() { 161 | return channel; 162 | } 163 | 164 | /** 165 | * @param channel 166 | * The channel 167 | */ 168 | public void setChannel(String channel) { 169 | this.channel = channel; 170 | } 171 | 172 | /** 173 | * @return The createdAt 174 | */ 175 | public String getCreatedAt() { 176 | return createdAt; 177 | } 178 | 179 | /** 180 | * @param createdAt 181 | * The createdAt 182 | */ 183 | public void setCreatedAt(String createdAt) { 184 | this.createdAt = createdAt; 185 | } 186 | 187 | /** 188 | * @return The display 189 | */ 190 | public Display getDisplay() { 191 | return display; 192 | } 193 | 194 | /** 195 | * @param display 196 | * The display 197 | */ 198 | public void setDisplay(Display display) { 199 | this.display = display; 200 | } 201 | 202 | /** 203 | * @return The manufacturer 204 | */ 205 | public String getManufacturer() { 206 | return manufacturer; 207 | } 208 | 209 | /** 210 | * @param manufacturer 211 | * The manufacturer 212 | */ 213 | public void setManufacturer(String manufacturer) { 214 | this.manufacturer = manufacturer; 215 | } 216 | 217 | /** 218 | * @return The model 219 | */ 220 | public String getModel() { 221 | return model; 222 | } 223 | 224 | /** 225 | * @param model 226 | * The model 227 | */ 228 | public void setModel(String model) { 229 | this.model = model; 230 | } 231 | 232 | /** 233 | * @return The network 234 | */ 235 | public Network getNetwork() { 236 | return network; 237 | } 238 | 239 | /** 240 | * @param network 241 | * The network 242 | */ 243 | public void setNetwork(Network network) { 244 | this.network = network; 245 | } 246 | 247 | /** 248 | * @return The operator 249 | */ 250 | public String getOperator() { 251 | return operator; 252 | } 253 | 254 | /** 255 | * @param operator 256 | * The operator 257 | */ 258 | public void setOperator(String operator) { 259 | this.operator = operator; 260 | } 261 | 262 | /** 263 | * @return The owner 264 | */ 265 | public Object getOwner() { 266 | return owner; 267 | } 268 | 269 | /** 270 | * @param owner 271 | * The owner 272 | */ 273 | public void setOwner(Object owner) { 274 | this.owner = owner; 275 | } 276 | 277 | /** 278 | * @return The phone 279 | */ 280 | public Phone getPhone() { 281 | return phone; 282 | } 283 | 284 | /** 285 | * @param phone 286 | * The phone 287 | */ 288 | public void setPhone(Phone phone) { 289 | this.phone = phone; 290 | } 291 | 292 | /** 293 | * @return The platform 294 | */ 295 | public String getPlatform() { 296 | return platform; 297 | } 298 | 299 | /** 300 | * @param platform 301 | * The platform 302 | */ 303 | public void setPlatform(String platform) { 304 | this.platform = platform; 305 | } 306 | 307 | /** 308 | * @return The presenceChangedAt 309 | */ 310 | public String getPresenceChangedAt() { 311 | return presenceChangedAt; 312 | } 313 | 314 | /** 315 | * @param presenceChangedAt 316 | * The presenceChangedAt 317 | */ 318 | public void setPresenceChangedAt(String presenceChangedAt) { 319 | this.presenceChangedAt = presenceChangedAt; 320 | } 321 | 322 | /** 323 | * @return The present 324 | */ 325 | public boolean isPresent() { 326 | return present; 327 | } 328 | 329 | /** 330 | * @param present 331 | * The present 332 | */ 333 | public void setPresent(boolean present) { 334 | this.present = present; 335 | } 336 | 337 | /** 338 | * @return The product 339 | */ 340 | public String getProduct() { 341 | return product; 342 | } 343 | 344 | /** 345 | * @param product 346 | * The product 347 | */ 348 | public void setProduct(String product) { 349 | this.product = product; 350 | } 351 | 352 | /** 353 | * @return The provider 354 | */ 355 | public Provider getProvider() { 356 | return provider; 357 | } 358 | 359 | /** 360 | * @param provider 361 | * The provider 362 | */ 363 | public void setProvider(Provider provider) { 364 | this.provider = provider; 365 | } 366 | 367 | /** 368 | * @return The ready 369 | */ 370 | public boolean isReady() { 371 | return ready; 372 | } 373 | 374 | /** 375 | * @param ready 376 | * The ready 377 | */ 378 | public void setReady(boolean ready) { 379 | this.ready = ready; 380 | } 381 | 382 | /** 383 | * @return The remoteConnect 384 | */ 385 | public boolean isRemoteConnect() { 386 | return remoteConnect; 387 | } 388 | 389 | /** 390 | * @param remoteConnect 391 | * The remoteConnect 392 | */ 393 | public void setRemoteConnect(boolean remoteConnect) { 394 | this.remoteConnect = remoteConnect; 395 | } 396 | 397 | /** 398 | * @return The remoteConnectUrl 399 | */ 400 | public Object getRemoteConnectUrl() { 401 | return remoteConnectUrl; 402 | } 403 | 404 | /** 405 | * @param remoteConnectUrl 406 | * The remoteConnectUrl 407 | */ 408 | public void setRemoteConnectUrl(Object remoteConnectUrl) { 409 | this.remoteConnectUrl = remoteConnectUrl; 410 | } 411 | 412 | /** 413 | * @return The reverseForwards 414 | */ 415 | public List getReverseForwards() { 416 | return reverseForwards; 417 | } 418 | 419 | /** 420 | * @param reverseForwards 421 | * The reverseForwards 422 | */ 423 | public void setReverseForwards(List reverseForwards) { 424 | this.reverseForwards = reverseForwards; 425 | } 426 | 427 | /** 428 | * @return The sdk 429 | */ 430 | public String getSdk() { 431 | return sdk; 432 | } 433 | 434 | /** 435 | * @param sdk 436 | * The sdk 437 | */ 438 | public void setSdk(String sdk) { 439 | this.sdk = sdk; 440 | } 441 | 442 | /** 443 | * @return The serial 444 | */ 445 | public String getSerial() { 446 | return serial; 447 | } 448 | 449 | /** 450 | * @param serial 451 | * The serial 452 | */ 453 | public void setSerial(String serial) { 454 | this.serial = serial; 455 | } 456 | 457 | /** 458 | * @return The status 459 | */ 460 | public int getStatus() { 461 | return status; 462 | } 463 | 464 | /** 465 | * @param status 466 | * The status 467 | */ 468 | public void setStatus(int status) { 469 | this.status = status; 470 | } 471 | 472 | /** 473 | * @return The statusChangedAt 474 | */ 475 | public String getStatusChangedAt() { 476 | return statusChangedAt; 477 | } 478 | 479 | /** 480 | * @param statusChangedAt 481 | * The statusChangedAt 482 | */ 483 | public void setStatusChangedAt(String statusChangedAt) { 484 | this.statusChangedAt = statusChangedAt; 485 | } 486 | 487 | /** 488 | * @return The version 489 | */ 490 | public String getVersion() { 491 | return version; 492 | } 493 | 494 | /** 495 | * @param version 496 | * The version 497 | */ 498 | public void setVersion(String version) { 499 | this.version = version; 500 | } 501 | 502 | /** 503 | * @return The using 504 | */ 505 | public boolean isUsing() { 506 | return using; 507 | } 508 | 509 | /** 510 | * @param using 511 | * The using 512 | */ 513 | public void setUsing(boolean using) { 514 | this.using = using; 515 | } 516 | 517 | @Override 518 | public String toString() { 519 | return "Device{" + "abi='" + abi + '\'' + ", airplaneMode=" + airplaneMode + ", battery=" + battery + ", browser=" + browser + ", channel='" + channel + '\'' + ", createdAt='" + createdAt + '\'' + ", display=" + display + ", manufacturer='" + manufacturer + '\'' + ", model='" + model + '\'' + ", network=" + network + ", operator='" + operator + '\'' + ", owner=" + owner + ", phone=" + phone + ", platform='" + platform + '\'' + ", presenceChangedAt='" + presenceChangedAt + '\'' + ", present=" + present + ", product='" + product + '\'' + ", provider=" + provider + ", ready=" + ready + ", remoteConnect=" + remoteConnect + ", remoteConnectUrl=" + remoteConnectUrl + ", reverseForwards=" + reverseForwards + ", sdk='" + sdk + '\'' + ", serial='" + serial + '\'' + ", status=" + status + ", statusChangedAt='" + statusChangedAt + '\'' + ", version='" + version + '\'' + ", using=" + using + '}'; 520 | } 521 | } 522 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/DeviceBody.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | /** 5 | * Created by yunusm on 08.11.2016. 6 | */ 7 | public class DeviceBody { 8 | 9 | private String serial; 10 | private int timeout; 11 | 12 | public DeviceBody(String serial, int timeout) { 13 | this.serial = serial; 14 | this.timeout = timeout; 15 | } 16 | 17 | public String getSerial() { 18 | return serial; 19 | } 20 | 21 | public void setSerial(String serial) { 22 | this.serial = serial; 23 | } 24 | 25 | public int getTimeout() { 26 | return timeout; 27 | } 28 | 29 | public void setTimeout(int timeout) { 30 | this.timeout = timeout; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Display.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Display { 8 | 9 | @SerializedName("density") 10 | @Expose 11 | private double density; 12 | @SerializedName("fps") 13 | @Expose 14 | private double fps; 15 | @SerializedName("height") 16 | @Expose 17 | private int height; 18 | @SerializedName("id") 19 | @Expose 20 | private int id; 21 | @SerializedName("rotation") 22 | @Expose 23 | private int rotation; 24 | @SerializedName("secure") 25 | @Expose 26 | private boolean secure; 27 | @SerializedName("size") 28 | @Expose 29 | private double size; 30 | @SerializedName("url") 31 | @Expose 32 | private String url; 33 | @SerializedName("width") 34 | @Expose 35 | private int width; 36 | @SerializedName("xdpi") 37 | @Expose 38 | private double xdpi; 39 | @SerializedName("ydpi") 40 | @Expose 41 | private double ydpi; 42 | 43 | /** 44 | * @return The density 45 | */ 46 | public double getDensity() { 47 | return density; 48 | } 49 | 50 | /** 51 | * @param density 52 | * The density 53 | */ 54 | public void setDensity(double density) { 55 | this.density = density; 56 | } 57 | 58 | /** 59 | * @return The fps 60 | */ 61 | public double getFps() { 62 | return fps; 63 | } 64 | 65 | /** 66 | * @param fps 67 | * The fps 68 | */ 69 | public void setFps(double fps) { 70 | this.fps = fps; 71 | } 72 | 73 | /** 74 | * @return The height 75 | */ 76 | public int getHeight() { 77 | return height; 78 | } 79 | 80 | /** 81 | * @param height 82 | * The height 83 | */ 84 | public void setHeight(int height) { 85 | this.height = height; 86 | } 87 | 88 | /** 89 | * @return The id 90 | */ 91 | public int getId() { 92 | return id; 93 | } 94 | 95 | /** 96 | * @param id 97 | * The id 98 | */ 99 | public void setId(int id) { 100 | this.id = id; 101 | } 102 | 103 | /** 104 | * @return The rotation 105 | */ 106 | public int getRotation() { 107 | return rotation; 108 | } 109 | 110 | /** 111 | * @param rotation 112 | * The rotation 113 | */ 114 | public void setRotation(int rotation) { 115 | this.rotation = rotation; 116 | } 117 | 118 | /** 119 | * @return The secure 120 | */ 121 | public boolean isSecure() { 122 | return secure; 123 | } 124 | 125 | /** 126 | * @param secure 127 | * The secure 128 | */ 129 | public void setSecure(boolean secure) { 130 | this.secure = secure; 131 | } 132 | 133 | /** 134 | * @return The size 135 | */ 136 | public double getSize() { 137 | return size; 138 | } 139 | 140 | /** 141 | * @param size 142 | * The size 143 | */ 144 | public void setSize(double size) { 145 | this.size = size; 146 | } 147 | 148 | /** 149 | * @return The url 150 | */ 151 | public String getUrl() { 152 | return url; 153 | } 154 | 155 | /** 156 | * @param url 157 | * The url 158 | */ 159 | public void setUrl(String url) { 160 | this.url = url; 161 | } 162 | 163 | /** 164 | * @return The width 165 | */ 166 | public int getWidth() { 167 | return width; 168 | } 169 | 170 | /** 171 | * @param width 172 | * The width 173 | */ 174 | public void setWidth(int width) { 175 | this.width = width; 176 | } 177 | 178 | /** 179 | * @return The xdpi 180 | */ 181 | public double getXdpi() { 182 | return xdpi; 183 | } 184 | 185 | /** 186 | * @param xdpi 187 | * The xdpi 188 | */ 189 | public void setXdpi(double xdpi) { 190 | this.xdpi = xdpi; 191 | } 192 | 193 | /** 194 | * @return The ydpi 195 | */ 196 | public double getYdpi() { 197 | return ydpi; 198 | } 199 | 200 | /** 201 | * @param ydpi 202 | * The ydpi 203 | */ 204 | public void setYdpi(double ydpi) { 205 | this.ydpi = ydpi; 206 | } 207 | 208 | @Override 209 | public String toString() { 210 | return "Display{" + "density=" + density + ", fps=" + fps + ", height=" + height + ", id=" + id + ", rotation=" + rotation + ", secure=" + secure + ", size=" + size + ", url='" + url + '\'' + ", width=" + width + ", xdpi=" + xdpi + ", ydpi=" + ydpi + '}'; 211 | } 212 | } 213 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Network.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import javax.annotation.Generated; 5 | import com.google.gson.annotations.Expose; 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | public class Network { 9 | 10 | @SerializedName("connected") 11 | @Expose 12 | private boolean connected; 13 | @SerializedName("failover") 14 | @Expose 15 | private boolean failover; 16 | @SerializedName("roaming") 17 | @Expose 18 | private boolean roaming; 19 | @SerializedName("subtype") 20 | @Expose 21 | private String subtype; 22 | @SerializedName("type") 23 | @Expose 24 | private String type; 25 | 26 | /** 27 | * @return The connected 28 | */ 29 | public boolean isConnected() { 30 | return connected; 31 | } 32 | 33 | /** 34 | * @param connected 35 | * The connected 36 | */ 37 | public void setConnected(boolean connected) { 38 | this.connected = connected; 39 | } 40 | 41 | /** 42 | * @return The failover 43 | */ 44 | public boolean isFailover() { 45 | return failover; 46 | } 47 | 48 | /** 49 | * @param failover 50 | * The failover 51 | */ 52 | public void setFailover(boolean failover) { 53 | this.failover = failover; 54 | } 55 | 56 | /** 57 | * @return The roaming 58 | */ 59 | public boolean isRoaming() { 60 | return roaming; 61 | } 62 | 63 | /** 64 | * @param roaming 65 | * The roaming 66 | */ 67 | public void setRoaming(boolean roaming) { 68 | this.roaming = roaming; 69 | } 70 | 71 | /** 72 | * @return The subtype 73 | */ 74 | public String getSubtype() { 75 | return subtype; 76 | } 77 | 78 | /** 79 | * @param subtype 80 | * The subtype 81 | */ 82 | public void setSubtype(String subtype) { 83 | this.subtype = subtype; 84 | } 85 | 86 | /** 87 | * @return The type 88 | */ 89 | public String getType() { 90 | return type; 91 | } 92 | 93 | /** 94 | * @param type 95 | * The type 96 | */ 97 | public void setType(String type) { 98 | this.type = type; 99 | } 100 | 101 | @Override 102 | public String toString() { 103 | return "Network{" + "connected=" + connected + ", failover=" + failover + ", roaming=" + roaming + ", subtype='" + subtype + '\'' + ", type='" + type + '\'' + '}'; 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Phone.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Phone { 8 | 9 | @SerializedName("iccid") 10 | @Expose 11 | private String iccid; 12 | @SerializedName("imei") 13 | @Expose 14 | private String imei; 15 | @SerializedName("network") 16 | @Expose 17 | private String network; 18 | @SerializedName("phoneNumber") 19 | @Expose 20 | private Object phoneNumber; 21 | 22 | /** 23 | * @return The iccid 24 | */ 25 | public String getIccid() { 26 | return iccid; 27 | } 28 | 29 | /** 30 | * @param iccid 31 | * The iccid 32 | */ 33 | public void setIccid(String iccid) { 34 | this.iccid = iccid; 35 | } 36 | 37 | /** 38 | * @return The imei 39 | */ 40 | public String getImei() { 41 | return imei; 42 | } 43 | 44 | /** 45 | * @param imei 46 | * The imei 47 | */ 48 | public void setImei(String imei) { 49 | this.imei = imei; 50 | } 51 | 52 | /** 53 | * @return The network 54 | */ 55 | public String getNetwork() { 56 | return network; 57 | } 58 | 59 | /** 60 | * @param network 61 | * The network 62 | */ 63 | public void setNetwork(String network) { 64 | this.network = network; 65 | } 66 | 67 | /** 68 | * @return The phoneNumber 69 | */ 70 | public Object getPhoneNumber() { 71 | return phoneNumber; 72 | } 73 | 74 | /** 75 | * @param phoneNumber 76 | * The phoneNumber 77 | */ 78 | public void setPhoneNumber(Object phoneNumber) { 79 | this.phoneNumber = phoneNumber; 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return "Phone{" + "iccid='" + iccid + '\'' + ", imei='" + imei + '\'' + ", network='" + network + '\'' + ", phoneNumber=" + phoneNumber + '}'; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Provider.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | public class Provider { 8 | 9 | @SerializedName("channel") 10 | @Expose 11 | private String channel; 12 | @SerializedName("name") 13 | @Expose 14 | private String name; 15 | 16 | /** 17 | * @return The channel 18 | */ 19 | public String getChannel() { 20 | return channel; 21 | } 22 | 23 | /** 24 | * @param channel 25 | * The channel 26 | */ 27 | public void setChannel(String channel) { 28 | this.channel = channel; 29 | } 30 | 31 | /** 32 | * @return The name 33 | */ 34 | public String getName() { 35 | return name; 36 | } 37 | 38 | /** 39 | * @param name 40 | * The name 41 | */ 42 | public void setName(String name) { 43 | this.name = name; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | return "Provider{" + "channel='" + channel + '\'' + ", name='" + name + '\'' + '}'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/Settings.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | /** 5 | * Created by yunusm on 10.11.2016. 6 | */ 7 | import com.google.gson.annotations.Expose; 8 | import com.google.gson.annotations.SerializedName; 9 | 10 | public class Settings { 11 | 12 | @SerializedName("lastUsedDevice") 13 | @Expose 14 | private String lastUsedDevice; 15 | @SerializedName("platform") 16 | @Expose 17 | private String platform; 18 | 19 | /** 20 | * @return The lastUsedDevice 21 | */ 22 | public String getLastUsedDevice() { 23 | return lastUsedDevice; 24 | } 25 | 26 | /** 27 | * @param lastUsedDevice 28 | * The lastUsedDevice 29 | */ 30 | public void setLastUsedDevice(String lastUsedDevice) { 31 | this.lastUsedDevice = lastUsedDevice; 32 | } 33 | 34 | /** 35 | * @return The platform 36 | */ 37 | public String getPlatform() { 38 | return platform; 39 | } 40 | 41 | /** 42 | * @param platform 43 | * The platform 44 | */ 45 | public void setPlatform(String platform) { 46 | this.platform = platform; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/model/User.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.model; 3 | 4 | /** 5 | * Created by yunusm on 10.11.2016. 6 | */ 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import javax.annotation.Generated; 11 | 12 | import com.google.gson.annotations.Expose; 13 | import com.google.gson.annotations.SerializedName; 14 | 15 | @Generated("org.jsonschema2pojo") 16 | public class User { 17 | 18 | @SerializedName("createdAt") 19 | @Expose 20 | private String createdAt; 21 | @SerializedName("email") 22 | @Expose 23 | private String email; 24 | @SerializedName("forwards") 25 | @Expose 26 | private List forwards = new ArrayList(); 27 | @SerializedName("group") 28 | @Expose 29 | private String group; 30 | @SerializedName("ip") 31 | @Expose 32 | private String ip; 33 | @SerializedName("lastLoggedInAt") 34 | @Expose 35 | private String lastLoggedInAt; 36 | @SerializedName("name") 37 | @Expose 38 | private String name; 39 | @SerializedName("settings") 40 | @Expose 41 | private Settings settings; 42 | 43 | /** 44 | * @return The createdAt 45 | */ 46 | public String getCreatedAt() { 47 | return createdAt; 48 | } 49 | 50 | /** 51 | * @param createdAt 52 | * The createdAt 53 | */ 54 | public void setCreatedAt(String createdAt) { 55 | this.createdAt = createdAt; 56 | } 57 | 58 | /** 59 | * @return The email 60 | */ 61 | public String getEmail() { 62 | return email; 63 | } 64 | 65 | /** 66 | * @param email 67 | * The email 68 | */ 69 | public void setEmail(String email) { 70 | this.email = email; 71 | } 72 | 73 | /** 74 | * @return The forwards 75 | */ 76 | public List getForwards() { 77 | return forwards; 78 | } 79 | 80 | /** 81 | * @param forwards 82 | * The forwards 83 | */ 84 | public void setForwards(List forwards) { 85 | this.forwards = forwards; 86 | } 87 | 88 | /** 89 | * @return The group 90 | */ 91 | public String getGroup() { 92 | return group; 93 | } 94 | 95 | /** 96 | * @param group 97 | * The group 98 | */ 99 | public void setGroup(String group) { 100 | this.group = group; 101 | } 102 | 103 | /** 104 | * @return The ip 105 | */ 106 | public String getIp() { 107 | return ip; 108 | } 109 | 110 | /** 111 | * @param ip 112 | * The ip 113 | */ 114 | public void setIp(String ip) { 115 | this.ip = ip; 116 | } 117 | 118 | /** 119 | * @return The lastLoggedInAt 120 | */ 121 | public String getLastLoggedInAt() { 122 | return lastLoggedInAt; 123 | } 124 | 125 | /** 126 | * @param lastLoggedInAt 127 | * The lastLoggedInAt 128 | */ 129 | public void setLastLoggedInAt(String lastLoggedInAt) { 130 | this.lastLoggedInAt = lastLoggedInAt; 131 | } 132 | 133 | /** 134 | * @return The name 135 | */ 136 | public String getName() { 137 | return name; 138 | } 139 | 140 | /** 141 | * @param name 142 | * The name 143 | */ 144 | public void setName(String name) { 145 | this.name = name; 146 | } 147 | 148 | /** 149 | * @return The settings 150 | */ 151 | public Settings getSettings() { 152 | return settings; 153 | } 154 | 155 | /** 156 | * @param settings 157 | * The settings 158 | */ 159 | public void setSettings(Settings settings) { 160 | this.settings = settings; 161 | } 162 | 163 | } -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/rest/ClaimResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.rest; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * Created by yunusm on 08.11.2016. 9 | */ 10 | public class ClaimResponse { 11 | 12 | @SerializedName("success") 13 | @Expose 14 | private boolean success; 15 | @SerializedName("description") 16 | @Expose 17 | private String description; 18 | 19 | /** 20 | * @return The success 21 | */ 22 | public boolean isSuccess() { 23 | return success; 24 | } 25 | 26 | /** 27 | * @param success 28 | * The success 29 | */ 30 | public void setSuccess(boolean success) { 31 | this.success = success; 32 | } 33 | 34 | /** 35 | * @return The description 36 | */ 37 | public String getDescription() { 38 | return description; 39 | } 40 | 41 | /** 42 | * @param description 43 | * The description 44 | */ 45 | public void setDescription(String description) { 46 | this.description = description; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | return "ClaimResponse{" + "success=" + success + ", description='" + description + '\'' + '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/rest/DeviceResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.rest; 3 | 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import com.google.gson.annotations.Expose; 8 | import com.google.gson.annotations.SerializedName; 9 | import com.github.yunusmete.stf.model.Device; 10 | 11 | /** 12 | * Created by yunusm on 08.11.2016. 13 | */ 14 | public class DeviceResponse { 15 | 16 | @SerializedName("success") 17 | @Expose 18 | private boolean success; 19 | @SerializedName("devices") 20 | @Expose 21 | private List devices = new ArrayList(); 22 | 23 | /** 24 | * @return The success 25 | */ 26 | public boolean isSuccess() { 27 | return success; 28 | } 29 | 30 | /** 31 | * @param success 32 | * The success 33 | */ 34 | public void setSuccess(boolean success) { 35 | this.success = success; 36 | } 37 | 38 | /** 39 | * @return The devices 40 | */ 41 | public List getDevices() { 42 | return devices; 43 | } 44 | 45 | /** 46 | * @param devices 47 | * The devices 48 | */ 49 | public void setDevices(List devices) { 50 | this.devices = devices; 51 | } 52 | 53 | @Override 54 | public String toString() { 55 | return "DeviceResponse{" + "success=" + success + ", devices=" + devices + '}'; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/rest/RemoteConnectResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.rest; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | 7 | /** 8 | * Created by yunusm on 10.11.2016. 9 | */ 10 | public class RemoteConnectResponse { 11 | 12 | @SerializedName("success") 13 | @Expose 14 | private boolean success; 15 | @SerializedName("remoteConnectUrl") 16 | @Expose 17 | private String remoteConnectUrl; 18 | 19 | /** 20 | * @return The success 21 | */ 22 | public boolean isSuccess() { 23 | return success; 24 | } 25 | 26 | /** 27 | * @param success 28 | * The success 29 | */ 30 | public void setSuccess(boolean success) { 31 | this.success = success; 32 | } 33 | 34 | /** 35 | * @return The remoteConnectUrl 36 | */ 37 | public String getRemoteConnectUrl() { 38 | return remoteConnectUrl; 39 | } 40 | 41 | /** 42 | * @param remoteConnectUrl 43 | * The remoteConnectUrl 44 | */ 45 | public void setRemoteConnectUrl(String remoteConnectUrl) { 46 | this.remoteConnectUrl = remoteConnectUrl; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/github/yunusmete/stf/rest/UserResponse.java: -------------------------------------------------------------------------------- 1 | 2 | package com.github.yunusmete.stf.rest; 3 | 4 | import com.google.gson.annotations.Expose; 5 | import com.google.gson.annotations.SerializedName; 6 | import com.github.yunusmete.stf.model.User; 7 | 8 | /** 9 | * Created by yunusm on 10.11.2016. 10 | */ 11 | public class UserResponse { 12 | 13 | @SerializedName("success") 14 | @Expose 15 | private boolean success; 16 | @SerializedName("user") 17 | @Expose 18 | private User user; 19 | 20 | /** 21 | * @return The success 22 | */ 23 | public boolean isSuccess() { 24 | return success; 25 | } 26 | 27 | /** 28 | * @param success 29 | * The success 30 | */ 31 | public void setSuccess(boolean success) { 32 | this.success = success; 33 | } 34 | 35 | /** 36 | * @return The user 37 | */ 38 | public User getUser() { 39 | return user; 40 | } 41 | 42 | /** 43 | * @param user 44 | * The user 45 | */ 46 | public void setUser(User user) { 47 | this.user = user; 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /src/test/java/AppiumTest.java: -------------------------------------------------------------------------------- 1 | import java.net.URL; 2 | 3 | import org.openqa.selenium.By; 4 | import org.openqa.selenium.WebElement; 5 | import org.openqa.selenium.remote.DesiredCapabilities; 6 | 7 | import io.appium.java_client.AppiumDriver; 8 | import io.appium.java_client.android.AndroidDriver; 9 | 10 | /** 11 | * Created by yunusm on 08.11.2016. 12 | */ 13 | public class AppiumTest { 14 | 15 | private AppiumDriver driver; 16 | 17 | public void setUp() throws Exception { 18 | DesiredCapabilities capabilities = new DesiredCapabilities(); 19 | capabilities.setCapability("deviceName", "Android Emulator"); 20 | capabilities.setCapability("platformVersion", "6.0"); 21 | capabilities.setCapability("app", "Your/App/Path"); 22 | driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); 23 | } 24 | 25 | public void tearDown() { 26 | driver.quit(); 27 | } 28 | 29 | public void apiDemo() { 30 | WebElement element = driver.findElement(By.id("test.state.netas.com.statetest:id/bt_state2")); 31 | element.click(); 32 | } 33 | 34 | public void startTest(String udid) { 35 | try { 36 | setUp(); 37 | apiDemo(); 38 | tearDown(); 39 | } 40 | catch (Exception e) { 41 | e.printStackTrace(); 42 | } 43 | 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /src/test/java/STF.java: -------------------------------------------------------------------------------- 1 | import java.util.List; 2 | 3 | import com.github.yunusmete.stf.api.STFService; 4 | import com.github.yunusmete.stf.api.ServiceGenerator; 5 | import com.github.yunusmete.stf.model.Device; 6 | import com.github.yunusmete.stf.model.DeviceBody; 7 | import com.github.yunusmete.stf.rest.DeviceResponse; 8 | 9 | /** 10 | * Created by yunusm on 07.11.2016. 11 | */ 12 | public class STF { 13 | 14 | private static final String ACCESS_TOKEN = "YOUR_STF_ACCESS_TOKEN"; 15 | 16 | public static void main(String[] args) { 17 | STFService service = ServiceGenerator.createService(STFService.class, "http://YOUR_STF_URL/api/v1", ACCESS_TOKEN); 18 | DeviceResponse devices = service.getDevices(); 19 | List deviceList = devices.getDevices(); 20 | for (Device device : deviceList) { 21 | if (device.isPresent()) { 22 | if (device.getOwner() == null) 23 | service.addDeviceToUser(new DeviceBody(device.getSerial(), 900000)); 24 | AppiumTest test = new AppiumTest(); 25 | test.startTest(device.getSerial()); 26 | service.deleteDeviceBySerial(device.getSerial()); 27 | } 28 | } 29 | } 30 | } 31 | --------------------------------------------------------------------------------