├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── architecture.png ├── dashboard.png ├── master ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── lampo │ │ │ └── device_lab │ │ │ └── master │ │ │ ├── MasterApplication.java │ │ │ ├── config │ │ │ ├── ClientConfiguration.java │ │ │ └── MVCConfiguration.java │ │ │ ├── controller │ │ │ ├── DeviceController.java │ │ │ ├── HomeController.java │ │ │ ├── PhoneImageController.java │ │ │ ├── SummaryController.java │ │ │ └── TeamController.java │ │ │ ├── exception │ │ │ └── DeviceManagerException.java │ │ │ ├── grid │ │ │ ├── CustomCapability.java │ │ │ ├── CustomGridNodeCapabilityMatcher.java │ │ │ ├── CustomGridRegistry.java │ │ │ ├── CustomRemoteProxy.java │ │ │ ├── DeviceFilter.java │ │ │ ├── DeviceMatchRequest.java │ │ │ └── GridSetupService.java │ │ │ ├── model │ │ │ ├── AllocateErrorMessage.java │ │ │ ├── AllocatedTo.java │ │ │ ├── AllocationStrategy.java │ │ │ ├── AppiumSession.java │ │ │ ├── AppiumSessionRequest.java │ │ │ ├── ClearDataRequest.java │ │ │ ├── CommandLineResponse.java │ │ │ ├── Device.java │ │ │ ├── DeviceInfo.java │ │ │ ├── DeviceInformation.java │ │ │ ├── DeviceMapping.java │ │ │ ├── DeviceRequest.java │ │ │ ├── DeviceRestrictionRequest.java │ │ │ ├── DeviceStatus.java │ │ │ ├── DeviceStatusModel.java │ │ │ ├── DeviceUpdateRequest.java │ │ │ ├── Header.java │ │ │ ├── HeldBy.java │ │ │ ├── ModelDevice.java │ │ │ ├── NodeCapability.java │ │ │ ├── OpenSTFHeldRequest.java │ │ │ ├── Photo.java │ │ │ ├── Platform.java │ │ │ ├── Summary.java │ │ │ ├── SummaryInfo.java │ │ │ ├── TeamMapping.java │ │ │ ├── ToJson.java │ │ │ ├── UninstallRequest.java │ │ │ └── User.java │ │ │ ├── repos │ │ │ ├── IDeviceRepository.java │ │ │ ├── IDeviceStatusRepository.java │ │ │ ├── IPhoneImageRepository.java │ │ │ ├── ISummaryRepository.java │ │ │ └── ITeamRepository.java │ │ │ ├── service │ │ │ ├── AllocationService.java │ │ │ ├── DeviceManagerExceptionHandler.java │ │ │ ├── IllegalAccessExceptionHandler.java │ │ │ ├── PhoneImageService.java │ │ │ ├── QueueMessageProcessor.java │ │ │ └── SessionReaper.java │ │ │ └── utils │ │ │ ├── CommandLineExecutor.java │ │ │ ├── CommonUtilities.java │ │ │ ├── ProcessUtilities.java │ │ │ └── RequestUtils.java │ └── resources │ │ ├── application.properties │ │ ├── application.yml │ │ ├── logback.xml │ │ ├── scripts │ │ └── grid.bash │ │ ├── static │ │ ├── css │ │ │ ├── bootstrap.min.css │ │ │ └── init.css │ │ ├── images │ │ │ ├── allocate.png │ │ │ ├── android.png │ │ │ ├── background.jpeg │ │ │ ├── bg.jpeg │ │ │ ├── chrome.png │ │ │ ├── close.png │ │ │ ├── favicon.png │ │ │ ├── google_icon.png │ │ │ ├── ios.png │ │ │ ├── logo.png │ │ │ ├── logout.png │ │ │ ├── manufacturer.png │ │ │ ├── mobile.png │ │ │ ├── phone.png │ │ │ ├── phones │ │ │ │ ├── Coolpad.png │ │ │ │ ├── Emulator.png │ │ │ │ ├── Honor Play.png │ │ │ │ ├── Lenovo TB-X306X.png │ │ │ │ ├── Motorola.png │ │ │ │ ├── Nokia HMD Global.png │ │ │ │ ├── Oppo.png │ │ │ │ ├── Realme.png │ │ │ │ ├── Samsung.png │ │ │ │ ├── Vivo.png │ │ │ │ ├── Xiaomi.png │ │ │ │ ├── default.png │ │ │ │ ├── iPad 6.png │ │ │ │ ├── iPad Pro (9.7-inch).png │ │ │ │ ├── iPhone 11 Pro Max.png │ │ │ │ └── iPhone SE.png │ │ │ ├── stf.png │ │ │ ├── upload.png │ │ │ ├── user.png │ │ │ └── view.png │ │ └── js │ │ │ ├── bootstrap.min.js │ │ │ ├── init.js │ │ │ ├── jquery.min.js │ │ │ ├── popper.min.js │ │ │ └── show-modal.js │ │ └── templates │ │ ├── devices.html │ │ ├── fragments │ │ ├── card.html │ │ └── file-uploader.html │ │ └── login.html │ └── test │ └── java │ └── com │ └── lampo │ └── device_lab │ └── master │ └── DeviceLabMasterApplicationTests.java └── slave ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src ├── main ├── java │ └── com │ │ └── lampo │ │ └── device_lab │ │ └── slave │ │ ├── SlaveApplication.java │ │ ├── config │ │ ├── AuthTokenFilter.java │ │ ├── ClientConfiguration.java │ │ ├── FilterConfiguration.java │ │ └── ResourceConfiguration.java │ │ ├── controller │ │ ├── DeviceController.java │ │ └── HomeController.java │ │ ├── model │ │ ├── AndroidDeviceProperty.java │ │ ├── AppiumSessionRequest.java │ │ ├── Capability.java │ │ ├── ClearDataRequest.java │ │ ├── CommandLineResponse.java │ │ ├── DeviceInfo.java │ │ ├── DeviceManagerException.java │ │ ├── DeviceUpdateRequest.java │ │ ├── GridConfiguration.java │ │ ├── GridNodeRegistrationRequest.java │ │ ├── Header.java │ │ ├── HeldBy.java │ │ ├── IDeviceProperty.java │ │ ├── IOSDeviceProperty.java │ │ ├── OpenSTFHeldRequest.java │ │ ├── Platform.java │ │ ├── ToJson.java │ │ └── UninstallRequest.java │ │ ├── service │ │ ├── DeviceManagerExceptionHandler.java │ │ ├── DeviceSyncProcessor.java │ │ ├── MaintenanceService.java │ │ └── OpenSTFService.java │ │ └── utils │ │ ├── ADBUtilities.java │ │ ├── AppiumLocalService.java │ │ ├── ChromeDriverExecutableUtils.java │ │ ├── CommandLineExecutor.java │ │ ├── CommonUtilities.java │ │ ├── IOSUtilities.java │ │ ├── ProcessUtilities.java │ │ └── STFServiceBuilder.java └── resources │ ├── application.properties │ ├── logback.xml │ └── scripts │ ├── stf.bash │ └── wd-session.bash └── test └── java └── com └── lampo └── device_lab └── slave └── SlaveApplicationTests.java /.gitignore: -------------------------------------------------------------------------------- 1 | #### Gradle and eclipse generated files ### 2 | ########################################### 3 | .classpath 4 | .project 5 | target 6 | .settings 7 | .gradle 8 | .idea 9 | .cache-* 10 | .DS_Store 11 | .vscode 12 | videos 13 | chromedriver 14 | node-config 15 | master/files 16 | 17 | ### build and output directories ### 18 | #################################### 19 | logs 20 | build 21 | test-output 22 | bin 23 | test-results 24 | screenshots 25 | jacoco.exec 26 | extent.html 27 | out 28 | *example* 29 | *.log 30 | 31 | ### Compiled source ### 32 | ####################### 33 | *.com 34 | *.class 35 | *.dll 36 | *.exe 37 | *.o 38 | *.so 39 | driver 40 | *allure* 41 | *.iml 42 | *.ipr 43 | *.iws 44 | download* 45 | 46 | ### Packages ### 47 | ################ 48 | # it's better to unpack these files and commit the raw source 49 | # git has its own built in compression methods 50 | *.7z 51 | *.dmg 52 | *.gz 53 | *.iso 54 | *.rar 55 | *.tar 56 | *.zip 57 | 58 | /.nb-gradle/ 59 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/CHANGELOG.md -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2021] [PharmEasyEngg] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, prepare derivatives of the work, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | This software uses open-source dependencies that are listed under the licenses - [Eclipse Public License v2.0](https://www.eclipse.org/legal/epl-2.0/), [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), [Server Side Public License](https://www.mongodb.com/licensing/server-side-public-license), [Mozilla Public License 2.0](https://www.mozilla.org/en-US/MPL/2.0/) and [MIT License](https://opensource.org/licenses/MIT). Please go through the description of the licenses to understand the usage agreement. 12 | 13 | By using the license, you agree that you have read, understood and agree to be bound by, including without any limitation by these terms and that the entire risk as to the quality and performance of the software is with you. 14 | -------------------------------------------------------------------------------- /architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/architecture.png -------------------------------------------------------------------------------- /dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/dashboard.png -------------------------------------------------------------------------------- /master/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.6.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | id 'war' 6 | id 'eclipse' 7 | id 'idea' 8 | } 9 | 10 | group = 'com.lampo' 11 | version = '1.0.0-RELEASE' 12 | sourceCompatibility = '1.8' 13 | 14 | configurations { 15 | compileOnly { 16 | extendsFrom annotationProcessor 17 | } 18 | } 19 | 20 | repositories { 21 | mavenCentral() 22 | } 23 | 24 | war { 25 | baseName = "master" 26 | archiveName = jar.baseName + ".war" 27 | } 28 | 29 | bootWar { 30 | archiveFileName = jar.baseName + ".war" 31 | } 32 | 33 | dependencies { 34 | implementation 'org.springframework.boot:spring-boot-starter-amqp' 35 | implementation 'org.springframework.boot:spring-boot-starter-data-mongodb' 36 | implementation 'org.springframework.boot:spring-boot-starter-quartz' 37 | implementation 'org.springframework.boot:spring-boot-starter-thymeleaf' 38 | implementation 'org.springframework.boot:spring-boot-starter-web' 39 | compileOnly 'org.projectlombok:lombok' 40 | implementation "org.apache.httpcomponents:httpclient" 41 | implementation 'org.springframework.boot:spring-boot-starter-webflux' 42 | 43 | compile "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml" 44 | 45 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 46 | annotationProcessor 'org.projectlombok:lombok' 47 | 48 | providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' 49 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 50 | testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo' 51 | testImplementation 'org.springframework.amqp:spring-rabbit-test' 52 | 53 | implementation "com.google.guava:guava:28.2-jre" 54 | implementation "org.seleniumhq.selenium:selenium-server:3.141.59" 55 | implementation 'org.jsoup:jsoup:1.14.3' 56 | 57 | 58 | 59 | 60 | //implementation 'org.springframework.security.oauth:spring-security-oauth2:2.5.1.RELEASE' 61 | //implementation 'org.springframework.security:spring-security-oauth2-client' 62 | //implementation 'org.springframework.security:spring-security-oauth2-jose' 63 | } 64 | 65 | tasks.named('test') { 66 | useJUnitPlatform() 67 | } 68 | -------------------------------------------------------------------------------- /master/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /master/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /master/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /master/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'master' 2 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/MasterApplication.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @SpringBootApplication 58 | @EnableScheduling 59 | public class MasterApplication extends SpringBootServletInitializer { 60 | 61 | @Override 62 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 63 | return application.sources(MasterApplication.class); 64 | } 65 | 66 | public static void main(String[] args) { 67 | SpringApplication.run(MasterApplication.class, args); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/config/MVCConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.config; 2 | 3 | import java.io.File; 4 | import java.nio.file.Paths; 5 | 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.web.servlet.config.annotation.CorsRegistry; 8 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 10 | 11 | /** 12 | * MIT License
13 | *
14 | * 15 | * Copyright (c) [2022] [PharmEasyEngg]
16 | *
17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, prepare derivatives of the work, and to permit 23 | * persons to whom the Software is furnished to do so, subject to the following 24 | * conditions:
25 | *
26 | * 27 | * The above copyright notice and this permission notice shall be included in 28 | * all copies or substantial portions of the Software.
29 | *
30 | * 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | * SOFTWARE.
38 | *
39 | * 40 | * 41 | * This software uses open-source dependencies that are listed under the 42 | * licenses - {@link Eclipse 43 | * Public License v2.0}, 44 | * {@link Apache 45 | * License 2.0}, {@link Server Side 47 | * Public License}, 48 | * {@link Mozilla Public 49 | * License 2.0} and {@link MIT 50 | * License}. Please go through the description of the licenses to understand 51 | * the usage agreement.
52 | *
53 | * 54 | * By using the license, you agree that you have read, understood and agree to 55 | * be bound by, including without any limitation by these terms and that the 56 | * entire risk as to the quality and performance of the software is with you. 57 | * 58 | */ 59 | @Configuration 60 | public class MVCConfiguration implements WebMvcConfigurer { 61 | 62 | public static final File RESOURCE_CREATION_DIR = Paths.get("files", "apps").toFile(); 63 | 64 | static { 65 | if (!RESOURCE_CREATION_DIR.exists()) { 66 | RESOURCE_CREATION_DIR.mkdirs(); 67 | } 68 | } 69 | 70 | @Override 71 | public void addCorsMappings(CorsRegistry registry) { 72 | registry.addMapping("/**").allowedMethods("GET", "POST"); 73 | } 74 | 75 | @Override 76 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 77 | 78 | if (!registry.hasMappingForPattern("/apps/**")) { 79 | registry.addResourceHandler("/apps/**").addResourceLocations(RESOURCE_CREATION_DIR.toURI().toString()); 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/exception/DeviceManagerException.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.exception; 2 | 3 | import org.springframework.http.HttpStatus; 4 | 5 | import lombok.NonNull; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | public class DeviceManagerException extends RuntimeException { 56 | 57 | private static final long serialVersionUID = 1L; 58 | private HttpStatus status; 59 | 60 | public DeviceManagerException(@NonNull String msg) { 61 | super(msg); 62 | } 63 | 64 | public DeviceManagerException(@NonNull String msg, @NonNull HttpStatus status) { 65 | super(msg); 66 | this.status = status; 67 | } 68 | 69 | public HttpStatus getStatus() { 70 | return this.status; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/grid/DeviceFilter.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.grid; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.lampo.device_lab.master.model.ToJson; 5 | 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | 10 | /** 11 | * MIT License
12 | *
13 | * 14 | * Copyright (c) [2022] [PharmEasyEngg]
15 | *
16 | * 17 | * Permission is hereby granted, free of charge, to any person obtaining a copy 18 | * of this software and associated documentation files (the "Software"), to deal 19 | * in the Software without restriction, including without limitation the rights 20 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | * copies of the Software, prepare derivatives of the work, and to permit 22 | * persons to whom the Software is furnished to do so, subject to the following 23 | * conditions:
24 | *
25 | * 26 | * The above copyright notice and this permission notice shall be included in 27 | * all copies or substantial portions of the Software.
28 | *
29 | * 30 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | * SOFTWARE.
37 | *
38 | * 39 | * 40 | * This software uses open-source dependencies that are listed under the 41 | * licenses - {@link Eclipse 42 | * Public License v2.0}, 43 | * {@link Apache 44 | * License 2.0}, {@link Server Side 46 | * Public License}, 47 | * {@link Mozilla Public 48 | * License 2.0} and {@link MIT 49 | * License}. Please go through the description of the licenses to understand 50 | * the usage agreement.
51 | *
52 | * 53 | * By using the license, you agree that you have read, understood and agree to 54 | * be bound by, including without any limitation by these terms and that the 55 | * entire risk as to the quality and performance of the software is with you. 56 | * 57 | */ 58 | @Data 59 | @NoArgsConstructor 60 | @AllArgsConstructor 61 | public class DeviceFilter implements ToJson { 62 | 63 | @JsonProperty("job_link") 64 | private String jobLink; 65 | 66 | @JsonProperty("team_name") 67 | private String teamName; 68 | } 69 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/grid/DeviceMatchRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.grid; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | import com.lampo.device_lab.master.model.NodeCapability; 5 | import com.lampo.device_lab.master.model.ToJson; 6 | 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * MIT License
13 | *
14 | * 15 | * Copyright (c) [2022] [PharmEasyEngg]
16 | *
17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, prepare derivatives of the work, and to permit 23 | * persons to whom the Software is furnished to do so, subject to the following 24 | * conditions:
25 | *
26 | * 27 | * The above copyright notice and this permission notice shall be included in 28 | * all copies or substantial portions of the Software.
29 | *
30 | * 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | * SOFTWARE.
38 | *
39 | * 40 | * 41 | * This software uses open-source dependencies that are listed under the 42 | * licenses - {@link Eclipse 43 | * Public License v2.0}, 44 | * {@link Apache 45 | * License 2.0}, {@link Server Side 47 | * Public License}, 48 | * {@link Mozilla Public 49 | * License 2.0} and {@link MIT 50 | * License}. Please go through the description of the licenses to understand 51 | * the usage agreement.
52 | *
53 | * 54 | * By using the license, you agree that you have read, understood and agree to 55 | * be bound by, including without any limitation by these terms and that the 56 | * entire risk as to the quality and performance of the software is with you. 57 | * 58 | */ 59 | @Data 60 | @NoArgsConstructor 61 | @AllArgsConstructor 62 | public class DeviceMatchRequest implements ToJson { 63 | 64 | private DeviceFilter filter; 65 | 66 | @JsonProperty("node_capability") 67 | private NodeCapability nodeCapability; 68 | } 69 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/AllocateErrorMessage.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2021] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public class AllocateErrorMessage { 52 | 53 | private String msg; 54 | 55 | public AllocateErrorMessage(String msg) { 56 | this.msg = msg; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | return msg; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/AllocatedTo.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | @AllArgsConstructor 56 | @NoArgsConstructor 57 | @Data 58 | public class AllocatedTo { 59 | 60 | private String ip; 61 | private String user; 62 | private String jenkinsJobLink; 63 | private String team; 64 | } 65 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/AllocationStrategy.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum AllocationStrategy { 52 | 53 | MANUAL_TESTING, AUTOMATION; 54 | } 55 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/AppiumSession.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.net.URL; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * MIT License
13 | *
14 | * 15 | * Copyright (c) [2021] [PharmEasyEngg]
16 | *
17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, prepare derivatives of the work, and to permit 23 | * persons to whom the Software is furnished to do so, subject to the following 24 | * conditions:
25 | *
26 | * 27 | * The above copyright notice and this permission notice shall be included in 28 | * all copies or substantial portions of the Software.
29 | *
30 | * 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | * SOFTWARE.
38 | *
39 | * 40 | * 41 | * This software uses open-source dependencies that are listed under the 42 | * licenses - {@link Eclipse 43 | * Public License v2.0}, 44 | * {@link Apache 45 | * License 2.0}, {@link Server Side 47 | * Public License}, 48 | * {@link Mozilla Public 49 | * License 2.0} and {@link MIT 50 | * License}. Please go through the description of the licenses to understand 51 | * the usage agreement.
52 | *
53 | * 54 | * By using the license, you agree that you have read, understood and agree to 55 | * be bound by, including without any limitation by these terms and that the 56 | * entire risk as to the quality and performance of the software is with you. 57 | * 58 | */ 59 | @NoArgsConstructor 60 | @AllArgsConstructor 61 | @Data 62 | public class AppiumSession implements ToJson { 63 | 64 | @JsonProperty("device_id") 65 | private String deviceId; 66 | 67 | @JsonProperty("device_name") 68 | private String deviceName; 69 | 70 | @JsonProperty("is_android") 71 | private boolean isAndroid; 72 | 73 | @JsonProperty("is_real_device") 74 | private boolean isRealDevice; 75 | 76 | @JsonProperty("sdk_version") 77 | private String sdkVersion; 78 | 79 | @JsonProperty("slave_ip") 80 | private String slaveIp; 81 | 82 | @JsonProperty("session_url") 83 | private URL sessionUrl; 84 | 85 | @JsonProperty("appium_logs_url") 86 | private URL appiumLogs; 87 | 88 | @JsonProperty("appium_video_url") 89 | private URL appiumVideo; 90 | } 91 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/AppiumSessionRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2021] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @NoArgsConstructor 58 | @AllArgsConstructor 59 | @Data 60 | public class AppiumSessionRequest { 61 | 62 | @JsonProperty("device_id") 63 | private String deviceId; 64 | 65 | @JsonProperty("clean_user_data") 66 | private boolean cleanUserData; 67 | 68 | @JsonProperty("record_video") 69 | private boolean recordVideo; 70 | 71 | @JsonProperty("app_package") 72 | private String appPackage; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/ClearDataRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @NoArgsConstructor 59 | @AllArgsConstructor 60 | public class ClearDataRequest implements ToJson { 61 | 62 | @JsonProperty("request_id") 63 | private String requestId; 64 | 65 | @JsonProperty("device_id") 66 | private String deviceId; 67 | 68 | @JsonProperty("package") 69 | private String packageName; 70 | } 71 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/CommandLineResponse.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | @Data 54 | public class CommandLineResponse { 55 | 56 | private int exitCode; 57 | private String stdOut; 58 | private String errOut; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceInfo.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | /** 9 | * MIT License
10 | *
11 | * 12 | * Copyright (c) [2022] [PharmEasyEngg]
13 | *
14 | * 15 | * Permission is hereby granted, free of charge, to any person obtaining a copy 16 | * of this software and associated documentation files (the "Software"), to deal 17 | * in the Software without restriction, including without limitation the rights 18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | * copies of the Software, prepare derivatives of the work, and to permit 20 | * persons to whom the Software is furnished to do so, subject to the following 21 | * conditions:
22 | *
23 | * 24 | * The above copyright notice and this permission notice shall be included in 25 | * all copies or substantial portions of the Software.
26 | *
27 | * 28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 | * SOFTWARE.
35 | *
36 | * 37 | * 38 | * This software uses open-source dependencies that are listed under the 39 | * licenses - {@link Eclipse 40 | * Public License v2.0}, 41 | * {@link Apache 42 | * License 2.0}, {@link Server Side 44 | * Public License}, 45 | * {@link Mozilla Public 46 | * License 2.0} and {@link MIT 47 | * License}. Please go through the description of the licenses to understand 48 | * the usage agreement.
49 | *
50 | * 51 | * By using the license, you agree that you have read, understood and agree to 52 | * be bound by, including without any limitation by these terms and that the 53 | * entire risk as to the quality and performance of the software is with you. 54 | * 55 | */ 56 | @Data 57 | @NoArgsConstructor 58 | public class DeviceInfo implements ToJson { 59 | 60 | @JsonProperty("request_id") 61 | private String requestId; 62 | 63 | @JsonProperty("slave_ip") 64 | private String slaveIp; 65 | 66 | @JsonProperty("appium_port") 67 | private int appiumPort; 68 | 69 | @JsonProperty("device_id") 70 | private String deviceId; 71 | 72 | @JsonProperty("platform_version") 73 | private String platformVersion; 74 | 75 | @JsonProperty("device_name") 76 | private String deviceName; 77 | 78 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceInformation.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.Data; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | @Data 56 | public class DeviceInformation implements ToJson { 57 | 58 | @JsonProperty("device_id") 59 | private String deviceId; 60 | 61 | @JsonProperty("sdk_version") 62 | private String sdkVersion; 63 | 64 | private String model; 65 | 66 | @JsonProperty("market_name") 67 | private String marketName; 68 | 69 | private String manufacturer; 70 | 71 | @JsonProperty("is_android") 72 | private boolean isAndroid; 73 | 74 | @JsonProperty("is_real_device") 75 | private boolean isRealDevice; 76 | 77 | @JsonProperty("browser_version") 78 | private String browserVersion; 79 | 80 | } 81 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceMapping.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import lombok.Data; 7 | 8 | /** 9 | * MIT License
10 | *
11 | * 12 | * Copyright (c) [2022] [PharmEasyEngg]
13 | *
14 | * 15 | * Permission is hereby granted, free of charge, to any person obtaining a copy 16 | * of this software and associated documentation files (the "Software"), to deal 17 | * in the Software without restriction, including without limitation the rights 18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 19 | * copies of the Software, prepare derivatives of the work, and to permit 20 | * persons to whom the Software is furnished to do so, subject to the following 21 | * conditions:
22 | *
23 | * 24 | * The above copyright notice and this permission notice shall be included in 25 | * all copies or substantial portions of the Software.
26 | *
27 | * 28 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 29 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 30 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 31 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 33 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 | * SOFTWARE.
35 | *
36 | * 37 | * 38 | * This software uses open-source dependencies that are listed under the 39 | * licenses - {@link Eclipse 40 | * Public License v2.0}, 41 | * {@link Apache 42 | * License 2.0}, {@link Server Side 44 | * Public License}, 45 | * {@link Mozilla Public 46 | * License 2.0} and {@link MIT 47 | * License}. Please go through the description of the licenses to understand 48 | * the usage agreement.
49 | *
50 | * 51 | * By using the license, you agree that you have read, understood and agree to 52 | * be bound by, including without any limitation by these terms and that the 53 | * entire risk as to the quality and performance of the software is with you. 54 | * 55 | */ 56 | @Data 57 | public class DeviceMapping { 58 | 59 | private List android = new ArrayList<>(); 60 | private List ios = new ArrayList<>(); 61 | 62 | } 63 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.List; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import lombok.Data; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | public class DeviceRequest implements ToJson { 59 | 60 | @JsonProperty("is_android") 61 | private String isAndroid; 62 | 63 | @JsonProperty("is_real_device") 64 | private String isRealDevice; 65 | 66 | private String brand; 67 | 68 | private String version; 69 | 70 | @JsonProperty("device_name") 71 | private String deviceName; 72 | 73 | @JsonProperty("clear_user_data") 74 | private boolean clearUserData; 75 | 76 | @JsonProperty("app_package") 77 | private String appPackage; 78 | 79 | @JsonProperty("record_video") 80 | private boolean recordVideo; 81 | 82 | @JsonProperty("device_ids") 83 | private List deviceIds; 84 | 85 | } 86 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceRestrictionRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.Arrays; 4 | import java.util.List; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import lombok.AllArgsConstructor; 9 | import lombok.Data; 10 | import lombok.NoArgsConstructor; 11 | import lombok.NonNull; 12 | 13 | /** 14 | * MIT License
15 | *
16 | * 17 | * Copyright (c) [2022] [PharmEasyEngg]
18 | *
19 | * 20 | * Permission is hereby granted, free of charge, to any person obtaining a copy 21 | * of this software and associated documentation files (the "Software"), to deal 22 | * in the Software without restriction, including without limitation the rights 23 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24 | * copies of the Software, prepare derivatives of the work, and to permit 25 | * persons to whom the Software is furnished to do so, subject to the following 26 | * conditions:
27 | *
28 | * 29 | * The above copyright notice and this permission notice shall be included in 30 | * all copies or substantial portions of the Software.
31 | *
32 | * 33 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 39 | * SOFTWARE.
40 | *
41 | * 42 | * 43 | * This software uses open-source dependencies that are listed under the 44 | * licenses - {@link Eclipse 45 | * Public License v2.0}, 46 | * {@link Apache 47 | * License 2.0}, {@link Server Side 49 | * Public License}, 50 | * {@link Mozilla Public 51 | * License 2.0} and {@link MIT 52 | * License}. Please go through the description of the licenses to understand 53 | * the usage agreement.
54 | *
55 | * 56 | * By using the license, you agree that you have read, understood and agree to 57 | * be bound by, including without any limitation by these terms and that the 58 | * entire risk as to the quality and performance of the software is with you. 59 | * 60 | */ 61 | @AllArgsConstructor 62 | @NoArgsConstructor 63 | @Data 64 | public class DeviceRestrictionRequest implements ToJson { 65 | 66 | @JsonProperty("device_id") 67 | private List deviceId; 68 | 69 | @JsonProperty("slave_ip") 70 | private String slaveIp; 71 | 72 | private String brand; 73 | 74 | @JsonProperty("device_name") 75 | private String deviceName; 76 | 77 | @JsonProperty("sdk_version") 78 | private String sdkVersion; 79 | 80 | public DeviceRestrictionRequest(@NonNull String deviceId, @NonNull String slaveIp) { 81 | this(Arrays.asList(deviceId), slaveIp, null, null, null); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceStatus.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum DeviceStatus { 52 | 53 | BUSY, FREE, REMOVE; 54 | } 55 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceStatusModel.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import org.springframework.data.annotation.Id; 4 | import org.springframework.data.mongodb.core.mapping.Document; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import lombok.Getter; 9 | import lombok.Setter; 10 | import lombok.ToString; 11 | 12 | /** 13 | * MIT License
14 | *
15 | * 16 | * Copyright (c) [2022] [PharmEasyEngg]
17 | *
18 | * 19 | * Permission is hereby granted, free of charge, to any person obtaining a copy 20 | * of this software and associated documentation files (the "Software"), to deal 21 | * in the Software without restriction, including without limitation the rights 22 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | * copies of the Software, prepare derivatives of the work, and to permit 24 | * persons to whom the Software is furnished to do so, subject to the following 25 | * conditions:
26 | *
27 | * 28 | * The above copyright notice and this permission notice shall be included in 29 | * all copies or substantial portions of the Software.
30 | *
31 | * 32 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 35 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 | * SOFTWARE.
39 | *
40 | * 41 | * 42 | * This software uses open-source dependencies that are listed under the 43 | * licenses - {@link Eclipse 44 | * Public License v2.0}, 45 | * {@link Apache 46 | * License 2.0}, {@link Server Side 48 | * Public License}, 49 | * {@link Mozilla Public 50 | * License 2.0} and {@link MIT 51 | * License}. Please go through the description of the licenses to understand 52 | * the usage agreement.
53 | *
54 | * 55 | * By using the license, you agree that you have read, understood and agree to 56 | * be bound by, including without any limitation by these terms and that the 57 | * entire risk as to the quality and performance of the software is with you. 58 | * 59 | */ 60 | @Document("device_status") 61 | @Getter 62 | @Setter 63 | @ToString 64 | public class DeviceStatusModel { 65 | 66 | @Id 67 | private String _id; 68 | private String id; 69 | 70 | @JsonProperty("is_blacklisted") 71 | private boolean isBlacklisted; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/DeviceUpdateRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.Collection; 4 | import java.util.Date; 5 | 6 | import com.fasterxml.jackson.annotation.JsonProperty; 7 | 8 | import lombok.Data; 9 | 10 | /** 11 | * MIT License
12 | *
13 | * 14 | * Copyright (c) [2022] [PharmEasyEngg]
15 | *
16 | * 17 | * Permission is hereby granted, free of charge, to any person obtaining a copy 18 | * of this software and associated documentation files (the "Software"), to deal 19 | * in the Software without restriction, including without limitation the rights 20 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | * copies of the Software, prepare derivatives of the work, and to permit 22 | * persons to whom the Software is furnished to do so, subject to the following 23 | * conditions:
24 | *
25 | * 26 | * The above copyright notice and this permission notice shall be included in 27 | * all copies or substantial portions of the Software.
28 | *
29 | * 30 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | * SOFTWARE.
37 | *
38 | * 39 | * 40 | * This software uses open-source dependencies that are listed under the 41 | * licenses - {@link Eclipse 42 | * Public License v2.0}, 43 | * {@link Apache 44 | * License 2.0}, {@link Server Side 46 | * Public License}, 47 | * {@link Mozilla Public 48 | * License 2.0} and {@link MIT 49 | * License}. Please go through the description of the licenses to understand 50 | * the usage agreement.
51 | *
52 | * 53 | * By using the license, you agree that you have read, understood and agree to 54 | * be bound by, including without any limitation by these terms and that the 55 | * entire risk as to the quality and performance of the software is with you. 56 | * 57 | */ 58 | @Data 59 | public class DeviceUpdateRequest implements ToJson { 60 | 61 | @JsonProperty("last_modified_time") 62 | private Date lastModifiedTime = new Date(); 63 | 64 | @JsonProperty("ip") 65 | private String ip; 66 | 67 | @JsonProperty("android_devices") 68 | private Collection androidDevices; 69 | 70 | @JsonProperty("ios_devices") 71 | private Collection iosDevices; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/Header.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum Header { 52 | 53 | JOB_LINK("x-job-link"), REQUEST_ID("x-device-request-id"), USER("x-request-user"), AUTH("x-auth-token"), 54 | TEAM("x-request-team"), REQUESTOR_IP("x-requestor-ip"); 55 | 56 | private String name; 57 | 58 | Header(String name) { 59 | this.name = name; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return name; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/HeldBy.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | @Data 56 | @NoArgsConstructor 57 | @AllArgsConstructor 58 | public class HeldBy { 59 | 60 | private String name; 61 | private String email; 62 | } 63 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/ModelDevice.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | @Data 54 | public class ModelDevice { 55 | 56 | private String ip; 57 | private boolean isConnected; 58 | private String deviceType; 59 | private String sdkVersion; 60 | private String manufacturer; 61 | private String marketName; 62 | private String imageUrl; 63 | private String browserVersion; 64 | private boolean isFree; 65 | private boolean isAndroid; 66 | private AllocationStrategy allocatedFor; 67 | private AllocatedTo allocatedTo; 68 | private String url; 69 | private String model; 70 | private String ownedBy; 71 | private HeldBy stfSessionHeldBy; 72 | 73 | } 74 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/NodeCapability.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | @Data 54 | public class NodeCapability implements ToJson { 55 | 56 | private String requestId; 57 | private String ip; 58 | private String deviceName; 59 | private String brand; 60 | private String platform; 61 | private String version; 62 | private String udid; 63 | private Boolean isRealDevice; 64 | 65 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/OpenSTFHeldRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.Map; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @AllArgsConstructor 59 | @NoArgsConstructor 60 | public class OpenSTFHeldRequest { 61 | 62 | private String ip; 63 | private Map devices; 64 | } 65 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/Photo.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import org.bson.types.Binary; 4 | import org.springframework.data.annotation.Id; 5 | import org.springframework.data.mongodb.core.mapping.Document; 6 | 7 | import lombok.Data; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2021] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @Document(collection = "phone-images") 59 | public class Photo { 60 | 61 | @Id 62 | private String id; 63 | 64 | private String name; 65 | 66 | private Binary image; 67 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/Platform.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum Platform { 52 | 53 | WINDOWS("win"), MACINTOSH("mac"), LINUX("linux"); 54 | 55 | private String name; 56 | 57 | private static final String OS_NAME = System.getProperty("os.name").toLowerCase(); 58 | public static final Platform CURRENT_PLATFORM = getCurrentPlatform(); 59 | 60 | Platform(String name) { 61 | this.name = name; 62 | } 63 | 64 | public String getName() { 65 | return name; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return name; 71 | } 72 | 73 | public String getArchitecture() { 74 | return System.getProperty("os.arch").contains("64") ? "64" : "32"; 75 | } 76 | 77 | private static Platform getCurrentPlatform() { 78 | if (OS_NAME.contains("win")) { 79 | return WINDOWS; 80 | } else if (OS_NAME.contains("mac")) { 81 | return Platform.MACINTOSH; 82 | } else if (OS_NAME.contains("linux")) { 83 | return LINUX; 84 | } 85 | return null; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/Summary.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.data.annotation.Id; 7 | import org.springframework.data.mongodb.core.mapping.Document; 8 | 9 | import com.fasterxml.jackson.annotation.JsonIgnore; 10 | 11 | import lombok.Data; 12 | 13 | /** 14 | * MIT License
15 | *
16 | * 17 | * Copyright (c) [2022] [PharmEasyEngg]
18 | *
19 | * 20 | * Permission is hereby granted, free of charge, to any person obtaining a copy 21 | * of this software and associated documentation files (the "Software"), to deal 22 | * in the Software without restriction, including without limitation the rights 23 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24 | * copies of the Software, prepare derivatives of the work, and to permit 25 | * persons to whom the Software is furnished to do so, subject to the following 26 | * conditions:
27 | *
28 | * 29 | * The above copyright notice and this permission notice shall be included in 30 | * all copies or substantial portions of the Software.
31 | *
32 | * 33 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 39 | * SOFTWARE.
40 | *
41 | * 42 | * 43 | * This software uses open-source dependencies that are listed under the 44 | * licenses - {@link Eclipse 45 | * Public License v2.0}, 46 | * {@link Apache 47 | * License 2.0}, {@link Server Side 49 | * Public License}, 50 | * {@link Mozilla Public 51 | * License 2.0} and {@link MIT 52 | * License}. Please go through the description of the licenses to understand 53 | * the usage agreement.
54 | *
55 | * 56 | * By using the license, you agree that you have read, understood and agree to 57 | * be bound by, including without any limitation by these terms and that the 58 | * entire risk as to the quality and performance of the software is with you. 59 | * 60 | */ 61 | @Document("summary") 62 | @Data 63 | public class Summary { 64 | 65 | @Id 66 | @JsonIgnore 67 | private String id; 68 | 69 | private String date; 70 | private Map info = new HashMap<>(); 71 | } 72 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/SummaryInfo.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @NoArgsConstructor 59 | @AllArgsConstructor 60 | public class SummaryInfo { 61 | 62 | @JsonProperty("number_of_sessions") 63 | private long numberOfSessions; 64 | 65 | @JsonProperty("total_duration") 66 | private long totalDuration; 67 | } 68 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/TeamMapping.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.HashMap; 4 | import java.util.List; 5 | import java.util.Map; 6 | 7 | import org.springframework.data.annotation.Id; 8 | import org.springframework.data.mongodb.core.mapping.Document; 9 | 10 | import com.fasterxml.jackson.annotation.JsonIgnore; 11 | 12 | import lombok.Data; 13 | 14 | /** 15 | * MIT License
16 | *
17 | * 18 | * Copyright (c) [2022] [PharmEasyEngg]
19 | *
20 | * 21 | * Permission is hereby granted, free of charge, to any person obtaining a copy 22 | * of this software and associated documentation files (the "Software"), to deal 23 | * in the Software without restriction, including without limitation the rights 24 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | * copies of the Software, prepare derivatives of the work, and to permit 26 | * persons to whom the Software is furnished to do so, subject to the following 27 | * conditions:
28 | *
29 | * 30 | * The above copyright notice and this permission notice shall be included in 31 | * all copies or substantial portions of the Software.
32 | *
33 | * 34 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 35 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 39 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 40 | * SOFTWARE.
41 | *
42 | * 43 | * 44 | * This software uses open-source dependencies that are listed under the 45 | * licenses - {@link Eclipse 46 | * Public License v2.0}, 47 | * {@link Apache 48 | * License 2.0}, {@link Server Side 50 | * Public License}, 51 | * {@link Mozilla Public 52 | * License 2.0} and {@link MIT 53 | * License}. Please go through the description of the licenses to understand 54 | * the usage agreement.
55 | *
56 | * 57 | * By using the license, you agree that you have read, understood and agree to 58 | * be bound by, including without any limitation by these terms and that the 59 | * entire risk as to the quality and performance of the software is with you. 60 | * 61 | */ 62 | @Data 63 | @Document("teams") 64 | public class TeamMapping { 65 | 66 | @Id 67 | @JsonIgnore 68 | private String id; 69 | 70 | private String name; 71 | private Map> jobs = new HashMap<>(); 72 | private DeviceMapping devices; 73 | 74 | } 75 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/ToJson.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import static com.lampo.device_lab.master.utils.CommonUtilities.pojoToJson; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | public interface ToJson { 54 | 55 | default String toJson() { 56 | return pojoToJson(this); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/UninstallRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.Collection; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | 11 | /** 12 | * MIT License
13 | *
14 | * 15 | * Copyright (c) [2022] [PharmEasyEngg]
16 | *
17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, prepare derivatives of the work, and to permit 23 | * persons to whom the Software is furnished to do so, subject to the following 24 | * conditions:
25 | *
26 | * 27 | * The above copyright notice and this permission notice shall be included in 28 | * all copies or substantial portions of the Software.
29 | *
30 | * 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | * SOFTWARE.
38 | *
39 | * 40 | * 41 | * This software uses open-source dependencies that are listed under the 42 | * licenses - {@link Eclipse 43 | * Public License v2.0}, 44 | * {@link Apache 45 | * License 2.0}, {@link Server Side 47 | * Public License}, 48 | * {@link Mozilla Public 49 | * License 2.0} and {@link MIT 50 | * License}. Please go through the description of the licenses to understand 51 | * the usage agreement.
52 | *
53 | * 54 | * By using the license, you agree that you have read, understood and agree to 55 | * be bound by, including without any limitation by these terms and that the 56 | * entire risk as to the quality and performance of the software is with you. 57 | * 58 | */ 59 | @Data 60 | @AllArgsConstructor 61 | @NoArgsConstructor 62 | public class UninstallRequest implements ToJson { 63 | 64 | @JsonProperty("request_id") 65 | private String requestId; 66 | 67 | @JsonProperty("device_id") 68 | private String deviceId; 69 | 70 | private Collection packages; 71 | } 72 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/model/User.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.model; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.mongodb.core.mapping.Document; 6 | 7 | import lombok.Data; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2021] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @Document("users") 59 | public class User { 60 | 61 | private String email; 62 | private List teams; 63 | 64 | } 65 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/repos/IDeviceStatusRepository.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.repos; 2 | 3 | import org.springframework.data.mongodb.repository.MongoRepository; 4 | 5 | import com.lampo.device_lab.master.model.DeviceStatusModel; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | public interface IDeviceStatusRepository extends MongoRepository { 56 | 57 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/repos/IPhoneImageRepository.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.repos; 2 | 3 | import java.util.Collection; 4 | 5 | import org.springframework.data.mongodb.repository.MongoRepository; 6 | import org.springframework.data.mongodb.repository.Query; 7 | 8 | import com.lampo.device_lab.master.model.Photo; 9 | 10 | /** 11 | * MIT License
12 | *
13 | * 14 | * Copyright (c) [2021] [PharmEasyEngg]
15 | *
16 | * 17 | * Permission is hereby granted, free of charge, to any person obtaining a copy 18 | * of this software and associated documentation files (the "Software"), to deal 19 | * in the Software without restriction, including without limitation the rights 20 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | * copies of the Software, prepare derivatives of the work, and to permit 22 | * persons to whom the Software is furnished to do so, subject to the following 23 | * conditions:
24 | *
25 | * 26 | * The above copyright notice and this permission notice shall be included in 27 | * all copies or substantial portions of the Software.
28 | *
29 | * 30 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | * SOFTWARE.
37 | *
38 | * 39 | * 40 | * This software uses open-source dependencies that are listed under the 41 | * licenses - {@link Eclipse 42 | * Public License v2.0}, 43 | * {@link Apache 44 | * License 2.0}, {@link Server Side 46 | * Public License}, 47 | * {@link Mozilla Public 48 | * License 2.0} and {@link MIT 49 | * License}. Please go through the description of the licenses to understand 50 | * the usage agreement.
51 | *
52 | * 53 | * By using the license, you agree that you have read, understood and agree to 54 | * be bound by, including without any limitation by these terms and that the 55 | * entire risk as to the quality and performance of the software is with you. 56 | * 57 | */ 58 | public interface IPhoneImageRepository extends MongoRepository { 59 | 60 | @Query("{'name': {$regex: ?0, $options: 'i'}})") 61 | public Collection findByName(String name); 62 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/service/DeviceManagerExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.service; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.http.ResponseEntity; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.context.request.WebRequest; 8 | 9 | import com.google.common.collect.ImmutableMap; 10 | import com.lampo.device_lab.master.exception.DeviceManagerException; 11 | 12 | import lombok.extern.slf4j.Slf4j; 13 | 14 | /** 15 | * MIT License
16 | *
17 | * 18 | * Copyright (c) [2022] [PharmEasyEngg]
19 | *
20 | * 21 | * Permission is hereby granted, free of charge, to any person obtaining a copy 22 | * of this software and associated documentation files (the "Software"), to deal 23 | * in the Software without restriction, including without limitation the rights 24 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | * copies of the Software, prepare derivatives of the work, and to permit 26 | * persons to whom the Software is furnished to do so, subject to the following 27 | * conditions:
28 | *
29 | * 30 | * The above copyright notice and this permission notice shall be included in 31 | * all copies or substantial portions of the Software.
32 | *
33 | * 34 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 35 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 39 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 40 | * SOFTWARE.
41 | *
42 | * 43 | * 44 | * This software uses open-source dependencies that are listed under the 45 | * licenses - {@link Eclipse 46 | * Public License v2.0}, 47 | * {@link Apache 48 | * License 2.0}, {@link Server Side 50 | * Public License}, 51 | * {@link Mozilla Public 52 | * License 2.0} and {@link MIT 53 | * License}. Please go through the description of the licenses to understand 54 | * the usage agreement.
55 | *
56 | * 57 | * By using the license, you agree that you have read, understood and agree to 58 | * be bound by, including without any limitation by these terms and that the 59 | * entire risk as to the quality and performance of the software is with you. 60 | * 61 | */ 62 | @Slf4j 63 | @ControllerAdvice 64 | public class DeviceManagerExceptionHandler { 65 | 66 | @ExceptionHandler(value = DeviceManagerException.class) 67 | public ResponseEntity deviceManagerExceptionHandler(DeviceManagerException ex, WebRequest request) { 68 | log.error(ex.getMessage()); 69 | return new ResponseEntity<>(ImmutableMap.of("error", ex.getMessage()), 70 | ex.getMessage().contains("auth") ? HttpStatus.UNAUTHORIZED 71 | : (ex.getMessage().contains("refused") ? HttpStatus.BAD_GATEWAY : HttpStatus.BAD_REQUEST)); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/service/IllegalAccessExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.service; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.http.ResponseEntity; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.context.request.WebRequest; 8 | 9 | import com.google.common.collect.ImmutableMap; 10 | 11 | import lombok.extern.slf4j.Slf4j; 12 | 13 | /** 14 | * MIT License
15 | *
16 | * 17 | * Copyright (c) [2022] [PharmEasyEngg]
18 | *
19 | * 20 | * Permission is hereby granted, free of charge, to any person obtaining a copy 21 | * of this software and associated documentation files (the "Software"), to deal 22 | * in the Software without restriction, including without limitation the rights 23 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 24 | * copies of the Software, prepare derivatives of the work, and to permit 25 | * persons to whom the Software is furnished to do so, subject to the following 26 | * conditions:
27 | *
28 | * 29 | * The above copyright notice and this permission notice shall be included in 30 | * all copies or substantial portions of the Software.
31 | *
32 | * 33 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 34 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 35 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 36 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 37 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 38 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 39 | * SOFTWARE.
40 | *
41 | * 42 | * 43 | * This software uses open-source dependencies that are listed under the 44 | * licenses - {@link Eclipse 45 | * Public License v2.0}, 46 | * {@link Apache 47 | * License 2.0}, {@link Server Side 49 | * Public License}, 50 | * {@link Mozilla Public 51 | * License 2.0} and {@link MIT 52 | * License}. Please go through the description of the licenses to understand 53 | * the usage agreement.
54 | *
55 | * 56 | * By using the license, you agree that you have read, understood and agree to 57 | * be bound by, including without any limitation by these terms and that the 58 | * entire risk as to the quality and performance of the software is with you. 59 | * 60 | */ 61 | @Slf4j 62 | @ControllerAdvice 63 | public class IllegalAccessExceptionHandler { 64 | 65 | @ExceptionHandler(value = IllegalAccessError.class) 66 | public ResponseEntity illegalAccessErrorHandler(IllegalAccessError ex, WebRequest request) { 67 | log.error(ex.getMessage()); 68 | return new ResponseEntity<>(ImmutableMap.of("error", ex.getMessage()), HttpStatus.UNAUTHORIZED); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/utils/ProcessUtilities.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.utils; 2 | 3 | import com.lampo.device_lab.master.model.CommandLineResponse; 4 | import com.lampo.device_lab.master.model.Platform; 5 | 6 | /** 7 | * MIT License
8 | *
9 | * 10 | * Copyright (c) [2022] [PharmEasyEngg]
11 | *
12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy 14 | * of this software and associated documentation files (the "Software"), to deal 15 | * in the Software without restriction, including without limitation the rights 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | * copies of the Software, prepare derivatives of the work, and to permit 18 | * persons to whom the Software is furnished to do so, subject to the following 19 | * conditions:
20 | *
21 | * 22 | * The above copyright notice and this permission notice shall be included in 23 | * all copies or substantial portions of the Software.
24 | *
25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE.
33 | *
34 | * 35 | * 36 | * This software uses open-source dependencies that are listed under the 37 | * licenses - {@link Eclipse 38 | * Public License v2.0}, 39 | * {@link Apache 40 | * License 2.0}, {@link Server Side 42 | * Public License}, 43 | * {@link Mozilla Public 44 | * License 2.0} and {@link MIT 45 | * License}. Please go through the description of the licenses to understand 46 | * the usage agreement.
47 | *
48 | * 49 | * By using the license, you agree that you have read, understood and agree to 50 | * be bound by, including without any limitation by these terms and that the 51 | * entire risk as to the quality and performance of the software is with you. 52 | * 53 | */ 54 | public class ProcessUtilities { 55 | 56 | private static final boolean IS_MAC = Platform.CURRENT_PLATFORM == Platform.MACINTOSH; 57 | 58 | private ProcessUtilities() { 59 | } 60 | 61 | /** 62 | * This method is to kill any process listening at the given port 63 | * 64 | * @param port {@link Integer} 65 | */ 66 | public static void kill(final int port) { 67 | if (port < 1) { 68 | return; 69 | } 70 | String command = String.format(IS_MAC ? "lsof -nti:%s | xargs kill -9" : "fuser -k %s/tcp", port); 71 | CommandLineExecutor.exec(command); 72 | } 73 | 74 | /** 75 | * This method is to kill all processes running at the given port 76 | * 77 | * @param process {@link String} 78 | */ 79 | public static void kill(final String process) { 80 | if (CommonUtilities.isBlank(process)) { 81 | return; 82 | } 83 | String command = String.format("ps -ef | grep '%s' | awk '{print $2}' | tr -s '\\n' ' ' | xargs kill -9", 84 | process.trim()); 85 | CommandLineExecutor.exec(command); 86 | } 87 | 88 | public static boolean isPortListening(int port) { 89 | 90 | String command = String.format("netstat -ant | grep -i listen | grep %s | wc -l | xargs", port); 91 | CommandLineResponse response = CommandLineExecutor.exec(command); 92 | return Integer.parseInt(response.getStdOut().replaceAll("[^0-9]", "")) > 0; 93 | } 94 | } -------------------------------------------------------------------------------- /master/src/main/java/com/lampo/device_lab/master/utils/RequestUtils.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master.utils; 2 | 3 | import static com.lampo.device_lab.master.utils.CommonUtilities.isBlank; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | public final class RequestUtils { 56 | 57 | private RequestUtils() { 58 | } 59 | 60 | private static final String LOCAL_IP_V4 = "127.0.0.1"; 61 | private static final String LOCAL_IP_V6 = "0:0:0:0:0:0:0:1"; 62 | 63 | public static String getClientIp(HttpServletRequest request) { 64 | 65 | if (request == null) { 66 | return LOCAL_IP_V4; 67 | } 68 | 69 | String ipAddress = request.getHeader("X-Forwarded-For"); 70 | if (isBlank(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { 71 | ipAddress = request.getHeader("Proxy-Client-IP"); 72 | } 73 | 74 | if (isBlank(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { 75 | ipAddress = request.getHeader("WL-Proxy-Client-IP"); 76 | } 77 | 78 | if (isBlank(ipAddress) || "unknown".equalsIgnoreCase(ipAddress)) { 79 | ipAddress = request.getRemoteAddr(); 80 | if (LOCAL_IP_V4.equals(ipAddress) || LOCAL_IP_V6.equals(ipAddress)) { 81 | ipAddress = CommonUtilities.getLocalNetworkIP(); 82 | } 83 | } 84 | if (!isBlank(ipAddress) && ipAddress.length() > 15 && ipAddress.indexOf(",") > 0) { 85 | ipAddress = ipAddress.substring(0, ipAddress.indexOf(",")); 86 | } 87 | 88 | return ipAddress; 89 | 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /master/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | custom.maintenance.enabled = true 2 | custom.reap_sessions.enabled = true 3 | custom.max_session_duration = 900 4 | custom.session.wait_timeout = 180 5 | custom.session.polling_timeout = 300 6 | custom.grid.download_url = https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar 7 | custom.cron.reap_long_running_sessions = */30 * * * * ? 8 | custom.cron.reap_unreachable_slaves: */30 * * * * ? 9 | custom.cron.check_grid_service = */15 * * * * ? 10 | custom.cron.reap_dead_sessions = */15 * * * * ? 11 | 12 | custom.upload_dirs = files 13 | 14 | queue.name = devices 15 | server.compression.enabled = true 16 | server.error.include-stacktrace = never 17 | server.port = 80 18 | server.servlet.context-path = / 19 | server.tomcat.connection-timeout = 1800000 20 | slave.auth_token = bW9iaWxlIGRldmljZSBsYWIgYXV0aCB0b2tlbg== 21 | slave.port = 5353 22 | spring.servlet.multipart.max-file-size = -1 23 | spring.servlet.multipart.max-request-size = -1 24 | spring.data.mongodb.url = mongodb://${MONGODB_HOST:localhost}:27017/device_lab -------------------------------------------------------------------------------- /master/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | custom: 2 | maintenance.enabled: true 3 | max_session_duration: 900 4 | session: 5 | wait_timeout: 60 6 | polling_timeout: 300 7 | grid: 8 | download_url: https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar 9 | cron: 10 | reap_long_running_sessions: '*/30 * * * * ?' 11 | reap_unreachable_slaves: '*/30 * * * * ?' 12 | check_grid_service: '*/15 * * * * ?' 13 | 14 | queue: 15 | name: devices 16 | server: 17 | compression: 18 | enabled: true 19 | error: 20 | include-stacktrace: never 21 | port: 5252 22 | servlet: 23 | context-path: / 24 | tomcat: 25 | connection-timeout: 1800000 26 | slave: 27 | auth_token: bW9iaWxlIGRldmljZSBsYWIgYXV0aCB0b2tlbg== 28 | port: 5353 29 | spring: 30 | data: 31 | mongodb: 32 | url: mongodb://${MONGODB_HOST:localhost}:27017/device_lab 33 | security: 34 | user: 35 | name: user 36 | password: user 37 | oauth2: 38 | client: 39 | registration: 40 | google: 41 | clientId: ${GOOGLE_OAUTH_CLIENT_ID} 42 | clientSecret: ${GOOGLE_OAUTH_CLIENT_SECRET} 43 | scope: 44 | - email 45 | - profile -------------------------------------------------------------------------------- /master/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 11 | logs/master.log 12 | 14 | logs/master-%d{yyyy-MM-dd}.%i.log.gz 15 | 16 | 10MB 17 | 30 18 | 10GB 19 | 20 | 21 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /master/src/main/resources/scripts/grid.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | 6 | if [ -f ~/.bash_profile ]; then source ~/.bash_profile; fi 7 | if [ -f ~/.bashrc ]; then source ~/.bashrc; fi 8 | if [ -f ~/.profile ]; then source ~/.profile; fi 9 | if [ -f ~/.zshrc ]; then source ~/.zshrc; fi 10 | 11 | 12 | cmd="$1/bin/java -jar '$2' -role hub -port $3 &> $4 2>&1 < /dev/null &" 13 | echo "executing cmd => $cmd" 14 | eval $cmd 15 | 16 | disown -------------------------------------------------------------------------------- /master/src/main/resources/static/css/init.css: -------------------------------------------------------------------------------- 1 | .grey { 2 | background: rgba(1, 1, 1, 0.10); 3 | } 4 | 5 | .bolder { 6 | font-weight: bolder; 7 | } 8 | 9 | .text-center-align { 10 | text-align: center 11 | } 12 | 13 | .smaller { 14 | font-size: 1.12em 15 | } 16 | 17 | .link-disabled { 18 | pointer-events: none; 19 | cursor: default; 20 | text-decoration: none; 21 | color: black; 22 | } 23 | 24 | .link-enabled { 25 | pointer-events: clicking; 26 | cursor: default; 27 | text-decoration: link; 28 | } 29 | 30 | .card:hover .text { 31 | visibility: visible; 32 | } 33 | 34 | .tip { 35 | position: relative; 36 | bottom: 30px; 37 | left: 0px; 38 | visibility: hidden; 39 | } 40 | 41 | html, body { 42 | overflow-x: hidden; 43 | background-size: 150%; 44 | height: 100%; 45 | } 46 | 47 | .col-sm-2 { 48 | border-radius: 2rem; 49 | margin: 0.5rem; 50 | min-width: 15rem; 51 | max-width: 15rem; 52 | } 53 | 54 | input { 55 | display: none; 56 | } 57 | 58 | .blur { 59 | filter: blur(8px); 60 | -webkit-filter: blur(8px); 61 | } 62 | 63 | .dialog-content { 64 | position: absolute; 65 | top: 25%; 66 | left: 50%; 67 | transform: translate(-50%, -50%); 68 | background-color: lightgray; 69 | box-sizing: border-box; 70 | padding: 10px; 71 | z-index: 100; 72 | display: none; 73 | } 74 | 75 | ul, #urls { 76 | list-style-type: none; 77 | } 78 | 79 | #urls { 80 | margin: 0; 81 | padding: 0; 82 | } 83 | 84 | .caret { 85 | cursor: pointer; 86 | -webkit-user-select: none; 87 | -moz-user-select: none; 88 | -ms-user-select: none; 89 | user-select: none; 90 | } 91 | 92 | .caret::before { 93 | content: "\25B6"; 94 | color: black; 95 | display: inline-block; 96 | margin-right: 6px; 97 | } 98 | 99 | .caret-down::before { 100 | -ms-transform: rotate(90deg); 101 | -webkit-transform: rotate(90deg); 102 | transform: rotate(90deg); 103 | } 104 | 105 | .nested { 106 | display: none; 107 | } 108 | 109 | .active { 110 | display: block; 111 | } -------------------------------------------------------------------------------- /master/src/main/resources/static/images/allocate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/allocate.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/android.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/background.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/background.jpeg -------------------------------------------------------------------------------- /master/src/main/resources/static/images/bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/bg.jpeg -------------------------------------------------------------------------------- /master/src/main/resources/static/images/chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/chrome.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/close.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/favicon.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/google_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/google_icon.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/ios.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/logo.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/logout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/logout.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/manufacturer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/manufacturer.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/mobile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/mobile.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phone.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Coolpad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Coolpad.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Emulator.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Emulator.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Honor Play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Honor Play.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Lenovo TB-X306X.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Lenovo TB-X306X.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Motorola.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Motorola.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Nokia HMD Global.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Nokia HMD Global.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Oppo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Oppo.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Realme.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Realme.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Samsung.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Samsung.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Vivo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Vivo.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/Xiaomi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/Xiaomi.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/default.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/iPad 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/iPad 6.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/iPad Pro (9.7-inch).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/iPad Pro (9.7-inch).png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/iPhone 11 Pro Max.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/iPhone 11 Pro Max.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/phones/iPhone SE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/phones/iPhone SE.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/stf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/stf.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/upload.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/user.png -------------------------------------------------------------------------------- /master/src/main/resources/static/images/view.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/master/src/main/resources/static/images/view.png -------------------------------------------------------------------------------- /master/src/main/resources/static/js/init.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | 3 | $("html").on('click', ".link-disabled", e => e.preventDefault()); 4 | 5 | $("#view-files").on('click', function() { 6 | let prefix = $('#directory').val(); 7 | $.ajax({ 8 | url: `files?prefix=${prefix}`, 9 | success: function(data) { 10 | $("#app-files").dialog({ 11 | autoOpen: false, 12 | modal: true, 13 | resizable: false, 14 | draggable: false, 15 | close: () => { 16 | $(".body").removeClass("blur"); 17 | window.location.reload(); 18 | }, 19 | title: "Uploaded Apps", 20 | width: '50%', 21 | height: ($(window).height() * 0.4), 22 | }); 23 | $("#app-files").html(data.map(e => `${e.split('/').at(-1)}`).join("
")); 24 | $("#app-files").dialog("open"); 25 | $("#ui-id-1").css({ 'text-align': 'center', 'margin-left': '30px' }); 26 | $("#app-files").css({ 'text-align': 'center', 'max-height': ($(window).height() - 200) }); 27 | $(".ui-dialog").css("max-height", ($(window).height() - 200)); 28 | $("div[role=dialog]").css({ 'max-height': '500px', 'top': '100px' }); 29 | } 30 | }).done(function() { 31 | $(".body").addClass("blur"); 32 | }) 33 | }); 34 | 35 | setInterval(() => { 36 | $.ajax({ 37 | url: 'refresh', success: data => { 38 | $(".container-fluid").parent().html(data); 39 | let links = $("a.card-link").not(".link-disabled"); 40 | } 41 | }) 42 | }, 5000); 43 | 44 | $(".close-btn").on('click', () => { 45 | $(".body").removeClass("blur"); 46 | $(".dialog-content").hide(); 47 | }); 48 | 49 | $("#file").on('change', function(e) { 50 | e.preventDefault(); 51 | 52 | let formData = new FormData(); 53 | formData.append("file", $('#file')[0].files[0]); 54 | formData.append("directory", $('#directory').val()); 55 | 56 | $.ajax({ 57 | type: 'POST', 58 | url: 'upload', 59 | processData: false, 60 | contentType: false, 61 | cache: false, 62 | data: formData, 63 | beforeSend: function() { 64 | $(".path").text(''); 65 | $("#popup-title").html(''); 66 | $("#loader").show(); 67 | $('#file').prop('disabled', true); 68 | }, 69 | success: function(response) { 70 | $("#popup-title").html('File Uploaded Successfully!'); 71 | $(".path").text(response); 72 | $(".dialog-content").toggle(); 73 | }, 74 | error: function(response) { 75 | alert(`error occurred while uploading file with message: ${response}`); 76 | } 77 | }).done(function() { 78 | $("#loader").hide(); 79 | $('#file').prop('disabled', false); 80 | $(".body").addClass("blur"); 81 | }); 82 | }); 83 | }); -------------------------------------------------------------------------------- /master/src/main/resources/templates/devices.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Devices 7 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 20 |
21 |
22 |
23 |
24 |
25 |
26 | 27 | -------------------------------------------------------------------------------- /master/src/main/resources/templates/fragments/file-uploader.html: -------------------------------------------------------------------------------- 1 |
3 | 9 | 11 | 12 | 15 | 16 | 17 | 21 | 26 | 31 | 32 |
Upload Apps 14 | to Host
25 | 30 |
33 |
34 | -------------------------------------------------------------------------------- /master/src/test/java/com/lampo/device_lab/master/DeviceLabMasterApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.master; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class DeviceLabMasterApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /slave/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.springframework.boot' version '2.6.3' 3 | id 'io.spring.dependency-management' version '1.0.11.RELEASE' 4 | id 'java' 5 | id 'war' 6 | id 'eclipse' 7 | id 'idea' 8 | } 9 | 10 | group = 'com.lampo' 11 | version = '1.0.0-RELEASE' 12 | sourceCompatibility = '1.8' 13 | 14 | configurations { 15 | compileOnly { 16 | extendsFrom annotationProcessor 17 | } 18 | } 19 | 20 | repositories { 21 | mavenCentral() 22 | } 23 | 24 | war { 25 | baseName = "slave" 26 | archiveName = jar.baseName + ".war" 27 | } 28 | 29 | bootWar { 30 | archiveFileName = jar.baseName + ".war" 31 | } 32 | 33 | dependencies { 34 | implementation 'org.springframework.boot:spring-boot-starter-amqp' 35 | implementation 'org.springframework.boot:spring-boot-starter-quartz' 36 | implementation 'org.springframework.boot:spring-boot-starter-web' 37 | compileOnly 'org.projectlombok:lombok' 38 | developmentOnly 'org.springframework.boot:spring-boot-devtools' 39 | annotationProcessor 'org.projectlombok:lombok' 40 | providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat' 41 | testImplementation 'org.springframework.boot:spring-boot-starter-test' 42 | testImplementation 'org.springframework.amqp:spring-rabbit-test' 43 | 44 | implementation "com.google.code.gson:gson:2.8.6" 45 | implementation "com.google.guava:guava:28.2-jre" 46 | implementation "org.rauschig:jarchivelib:1.0.0" 47 | implementation 'com.rethinkdb:rethinkdb-driver:2.4.4' 48 | } 49 | 50 | tasks.named('test') { 51 | useJUnitPlatform() 52 | } 53 | -------------------------------------------------------------------------------- /slave/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PharmEasyEngg/lampo/af85c1ddab2bfd4010b15a6587773527800ee311/slave/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /slave/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /slave/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /slave/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'slave' 2 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/SlaveApplication.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 7 | import org.springframework.scheduling.annotation.EnableScheduling; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @SpringBootApplication 58 | @EnableScheduling 59 | public class SlaveApplication extends SpringBootServletInitializer { 60 | 61 | @Override 62 | protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 63 | return application.sources(SlaveApplication.class); 64 | } 65 | 66 | public static void main(String[] args) { 67 | SpringApplication.run(SlaveApplication.class, args); 68 | } 69 | 70 | } 71 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/config/FilterConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.config; 2 | 3 | import javax.servlet.Filter; 4 | 5 | import org.springframework.beans.factory.annotation.Value; 6 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.stereotype.Component; 9 | 10 | /** 11 | * MIT License
12 | *
13 | * 14 | * Copyright (c) [2022] [PharmEasyEngg]
15 | *
16 | * 17 | * Permission is hereby granted, free of charge, to any person obtaining a copy 18 | * of this software and associated documentation files (the "Software"), to deal 19 | * in the Software without restriction, including without limitation the rights 20 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 21 | * copies of the Software, prepare derivatives of the work, and to permit 22 | * persons to whom the Software is furnished to do so, subject to the following 23 | * conditions:
24 | *
25 | * 26 | * The above copyright notice and this permission notice shall be included in 27 | * all copies or substantial portions of the Software.
28 | *
29 | * 30 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | * SOFTWARE.
37 | *
38 | * 39 | * 40 | * This software uses open-source dependencies that are listed under the 41 | * licenses - {@link Eclipse 42 | * Public License v2.0}, 43 | * {@link Apache 44 | * License 2.0}, {@link Server Side 46 | * Public License}, 47 | * {@link Mozilla Public 48 | * License 2.0} and {@link MIT 49 | * License}. Please go through the description of the licenses to understand 50 | * the usage agreement.
51 | *
52 | * 53 | * By using the license, you agree that you have read, understood and agree to 54 | * be bound by, including without any limitation by these terms and that the 55 | * entire risk as to the quality and performance of the software is with you. 56 | * 57 | */ 58 | @Component 59 | public class FilterConfiguration { 60 | 61 | @Value("${slave.auth_token}") 62 | private String authToken; 63 | 64 | @Bean 65 | public FilterRegistrationBean authFilter() { 66 | FilterRegistrationBean registrationBean = new FilterRegistrationBean<>(); 67 | registrationBean.setFilter(new AuthTokenFilter(authToken)); 68 | registrationBean.addUrlPatterns("/device/*"); 69 | return registrationBean; 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/config/ResourceConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.config; 2 | 3 | import static com.lampo.device_lab.slave.utils.AppiumLocalService.Builder.LOG_DIRECTORY; 4 | 5 | import java.io.File; 6 | 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.web.servlet.config.annotation.EnableWebMvc; 9 | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; 10 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 11 | 12 | /** 13 | * MIT License
14 | *
15 | * 16 | * Copyright (c) [2022] [PharmEasyEngg]
17 | *
18 | * 19 | * Permission is hereby granted, free of charge, to any person obtaining a copy 20 | * of this software and associated documentation files (the "Software"), to deal 21 | * in the Software without restriction, including without limitation the rights 22 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | * copies of the Software, prepare derivatives of the work, and to permit 24 | * persons to whom the Software is furnished to do so, subject to the following 25 | * conditions:
26 | *
27 | * 28 | * The above copyright notice and this permission notice shall be included in 29 | * all copies or substantial portions of the Software.
30 | *
31 | * 32 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 33 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 34 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 35 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 36 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 37 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 38 | * SOFTWARE.
39 | *
40 | * 41 | * 42 | * This software uses open-source dependencies that are listed under the 43 | * licenses - {@link Eclipse 44 | * Public License v2.0}, 45 | * {@link Apache 46 | * License 2.0}, {@link Server Side 48 | * Public License}, 49 | * {@link Mozilla Public 50 | * License 2.0} and {@link MIT 51 | * License}. Please go through the description of the licenses to understand 52 | * the usage agreement.
53 | *
54 | * 55 | * By using the license, you agree that you have read, understood and agree to 56 | * be bound by, including without any limitation by these terms and that the 57 | * entire risk as to the quality and performance of the software is with you. 58 | * 59 | */ 60 | @Configuration 61 | @EnableWebMvc 62 | public class ResourceConfiguration implements WebMvcConfigurer { 63 | 64 | public static final File RESOURCE_CREATION_DIR = new File(LOG_DIRECTORY); 65 | 66 | static { 67 | if (!RESOURCE_CREATION_DIR.exists()) { 68 | RESOURCE_CREATION_DIR.mkdirs(); 69 | } 70 | } 71 | 72 | @Override 73 | public void addResourceHandlers(ResourceHandlerRegistry registry) { 74 | if (!registry.hasMappingForPattern("/appium/logs/**")) { 75 | registry.addResourceHandler("/appium/logs/**") 76 | .addResourceLocations(RESOURCE_CREATION_DIR.toURI().toString()); 77 | } 78 | 79 | if (!registry.hasMappingForPattern("/appium/videos/**")) { 80 | registry.addResourceHandler("/appium/videos/**") 81 | .addResourceLocations(RESOURCE_CREATION_DIR.toURI().toString()); 82 | } 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * MIT License
8 | *
9 | * 10 | * Copyright (c) [2022] [PharmEasyEngg]
11 | *
12 | * 13 | * Permission is hereby granted, free of charge, to any person obtaining a copy 14 | * of this software and associated documentation files (the "Software"), to deal 15 | * in the Software without restriction, including without limitation the rights 16 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 | * copies of the Software, prepare derivatives of the work, and to permit 18 | * persons to whom the Software is furnished to do so, subject to the following 19 | * conditions:
20 | *
21 | * 22 | * The above copyright notice and this permission notice shall be included in 23 | * all copies or substantial portions of the Software.
24 | *
25 | * 26 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE.
33 | *
34 | * 35 | * 36 | * This software uses open-source dependencies that are listed under the 37 | * licenses - {@link Eclipse 38 | * Public License v2.0}, 39 | * {@link Apache 40 | * License 2.0}, {@link Server Side 42 | * Public License}, 43 | * {@link Mozilla Public 44 | * License 2.0} and {@link MIT 45 | * License}. Please go through the description of the licenses to understand 46 | * the usage agreement.
47 | *
48 | * 49 | * By using the license, you agree that you have read, understood and agree to 50 | * be bound by, including without any limitation by these terms and that the 51 | * entire risk as to the quality and performance of the software is with you. 52 | * 53 | */ 54 | @RestController 55 | public class HomeController { 56 | 57 | @GetMapping("/status") 58 | public String home() { 59 | return "slave app is up!"; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/AppiumSessionRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @NoArgsConstructor 58 | @AllArgsConstructor 59 | @Data 60 | public class AppiumSessionRequest implements ToJson { 61 | 62 | private static final long serialVersionUID = 1L; 63 | 64 | @JsonProperty("device_id") 65 | private String deviceId; 66 | 67 | @JsonProperty("clean_user_data") 68 | private boolean cleanUserData; 69 | 70 | @JsonProperty("record_video") 71 | private boolean recordVideo; 72 | 73 | @JsonProperty("app_package") 74 | private String appPackage; 75 | 76 | } 77 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/ClearDataRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.Data; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | @Data 56 | public class ClearDataRequest { 57 | 58 | @JsonProperty("request_id") 59 | private String requestId; 60 | 61 | @JsonProperty("device_id") 62 | private String deviceId; 63 | 64 | @JsonProperty("package") 65 | private String packageName; 66 | } 67 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/CommandLineResponse.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | @Data 54 | public class CommandLineResponse { 55 | 56 | private int exitCode; 57 | private String stdOut; 58 | private String errOut; 59 | 60 | } 61 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/DeviceInfo.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @NoArgsConstructor 59 | @AllArgsConstructor 60 | public class DeviceInfo implements ToJson { 61 | 62 | private static final long serialVersionUID = 1L; 63 | 64 | @JsonProperty("slave_ip") 65 | private String slaveIp; 66 | 67 | @JsonProperty("device_id") 68 | private String deviceId; 69 | } 70 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/DeviceManagerException.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public class DeviceManagerException extends RuntimeException { 52 | 53 | private static final long serialVersionUID = 1L; 54 | 55 | public DeviceManagerException(Throwable ex) { 56 | super(ex); 57 | } 58 | 59 | public DeviceManagerException(String msg) { 60 | super(msg); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/DeviceUpdateRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import java.util.Collection; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | import com.google.gson.annotations.Expose; 7 | import com.google.gson.annotations.SerializedName; 8 | 9 | import lombok.Data; 10 | 11 | /** 12 | * MIT License
13 | *
14 | * 15 | * Copyright (c) [2022] [PharmEasyEngg]
16 | *
17 | * 18 | * Permission is hereby granted, free of charge, to any person obtaining a copy 19 | * of this software and associated documentation files (the "Software"), to deal 20 | * in the Software without restriction, including without limitation the rights 21 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 22 | * copies of the Software, prepare derivatives of the work, and to permit 23 | * persons to whom the Software is furnished to do so, subject to the following 24 | * conditions:
25 | *
26 | * 27 | * The above copyright notice and this permission notice shall be included in 28 | * all copies or substantial portions of the Software.
29 | *
30 | * 31 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | * SOFTWARE.
38 | *
39 | * 40 | * 41 | * This software uses open-source dependencies that are listed under the 42 | * licenses - {@link Eclipse 43 | * Public License v2.0}, 44 | * {@link Apache 45 | * License 2.0}, {@link Server Side 47 | * Public License}, 48 | * {@link Mozilla Public 49 | * License 2.0} and {@link MIT 50 | * License}. Please go through the description of the licenses to understand 51 | * the usage agreement.
52 | *
53 | * 54 | * By using the license, you agree that you have read, understood and agree to 55 | * be bound by, including without any limitation by these terms and that the 56 | * entire risk as to the quality and performance of the software is with you. 57 | * 58 | */ 59 | @Data 60 | public class DeviceUpdateRequest implements ToJson { 61 | 62 | private static final long serialVersionUID = 1L; 63 | 64 | @Expose 65 | @JsonProperty("ip") 66 | private String ip; 67 | 68 | @Expose 69 | @SerializedName("android_devices") 70 | @JsonProperty("android_devices") 71 | private Collection androidDevices; 72 | 73 | @Expose 74 | @SerializedName("ios_devices") 75 | @JsonProperty("ios_devices") 76 | private Collection iosDevices; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/GridConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import static com.lampo.device_lab.slave.utils.CommonUtilities.getLocalNetworkIP; 4 | 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.NonNull; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @NoArgsConstructor 59 | public class GridConfiguration implements ToJson { 60 | 61 | private static final long serialVersionUID = 1L; 62 | 63 | private int cleanUpCycle = 30; 64 | private int timeout = 30; 65 | private String proxy = "com.lampo.device_lab.master.grid.CustomRemoteProxy"; 66 | private String url; 67 | private String host; 68 | private int port; 69 | private int maxSession = 1; 70 | private boolean register = true; 71 | private int registerCycle = 5000; 72 | private int hubPort = 4444; 73 | private String hubHost; 74 | private String hubProtocol = "http"; 75 | private int unregisterIfStillDownAfter = 10000; 76 | private boolean debug = true; 77 | 78 | public GridConfiguration(int port) { 79 | this(getLocalNetworkIP(), port); 80 | } 81 | 82 | public GridConfiguration(@NonNull String host, int port) { 83 | this(getLocalNetworkIP(), host, port); 84 | } 85 | 86 | public GridConfiguration(@NonNull String hubHost, @NonNull String host, int port) { 87 | this.hubHost = hubHost; 88 | this.host = host; 89 | this.port = port; 90 | this.url = String.format("%s://%s:%s/wd/hub", hubProtocol, host, port); 91 | } 92 | 93 | } 94 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/Header.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum Header { 52 | 53 | REQUEST_ID("x-device-request-id"), 54 | AUTH("x-auth-token"); 55 | 56 | private String name; 57 | 58 | Header(String name) { 59 | this.name = name; 60 | } 61 | 62 | @Override 63 | public String toString() { 64 | return name; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/HeldBy.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Data; 5 | import lombok.NoArgsConstructor; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | @Data 56 | @NoArgsConstructor 57 | @AllArgsConstructor 58 | public class HeldBy { 59 | 60 | private String name; 61 | private String email; 62 | } 63 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/IDeviceProperty.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public interface IDeviceProperty extends ToJson { 52 | 53 | public String getDeviceId(); 54 | 55 | public boolean isAndroid(); 56 | 57 | public boolean isRealDevice(); 58 | 59 | public String getSdkVersion(); 60 | 61 | public String getDeviceName(); 62 | 63 | } 64 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/OpenSTFHeldRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import java.util.Map; 4 | 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | @AllArgsConstructor 59 | @NoArgsConstructor 60 | public class OpenSTFHeldRequest { 61 | 62 | private String ip; 63 | private Map devices; 64 | } 65 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/Platform.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | /** 4 | * MIT License
5 | *
6 | * 7 | * Copyright (c) [2022] [PharmEasyEngg]
8 | *
9 | * 10 | * Permission is hereby granted, free of charge, to any person obtaining a copy 11 | * of this software and associated documentation files (the "Software"), to deal 12 | * in the Software without restriction, including without limitation the rights 13 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | * copies of the Software, prepare derivatives of the work, and to permit 15 | * persons to whom the Software is furnished to do so, subject to the following 16 | * conditions:
17 | *
18 | * 19 | * The above copyright notice and this permission notice shall be included in 20 | * all copies or substantial portions of the Software.
21 | *
22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | * SOFTWARE.
30 | *
31 | * 32 | * 33 | * This software uses open-source dependencies that are listed under the 34 | * licenses - {@link Eclipse 35 | * Public License v2.0}, 36 | * {@link Apache 37 | * License 2.0}, {@link Server Side 39 | * Public License}, 40 | * {@link Mozilla Public 41 | * License 2.0} and {@link MIT 42 | * License}. Please go through the description of the licenses to understand 43 | * the usage agreement.
44 | *
45 | * 46 | * By using the license, you agree that you have read, understood and agree to 47 | * be bound by, including without any limitation by these terms and that the 48 | * entire risk as to the quality and performance of the software is with you. 49 | * 50 | */ 51 | public enum Platform { 52 | 53 | WINDOWS("win"), MACINTOSH("mac"), LINUX("linux"); 54 | 55 | private String name; 56 | 57 | private static final String OS_NAME = System.getProperty("os.name").toLowerCase(); 58 | public static final Platform CURRENT_PLATFORM = getCurrentPlatform(); 59 | 60 | Platform(String name) { 61 | this.name = name; 62 | } 63 | 64 | public String getName() { 65 | return name; 66 | } 67 | 68 | @Override 69 | public String toString() { 70 | return name; 71 | } 72 | 73 | public String getArchitecture() { 74 | return System.getProperty("os.arch").contains("64") ? "64" : "32"; 75 | } 76 | 77 | private static Platform getCurrentPlatform() { 78 | if (OS_NAME.contains("win")) { 79 | return WINDOWS; 80 | } else if (OS_NAME.contains("mac")) { 81 | return Platform.MACINTOSH; 82 | } else if (OS_NAME.contains("linux")) { 83 | return LINUX; 84 | } 85 | return null; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/ToJson.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import static com.lampo.device_lab.slave.utils.CommonUtilities.pojoToJson; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * MIT License
9 | *
10 | * 11 | * Copyright (c) [2022] [PharmEasyEngg]
12 | *
13 | * 14 | * Permission is hereby granted, free of charge, to any person obtaining a copy 15 | * of this software and associated documentation files (the "Software"), to deal 16 | * in the Software without restriction, including without limitation the rights 17 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | * copies of the Software, prepare derivatives of the work, and to permit 19 | * persons to whom the Software is furnished to do so, subject to the following 20 | * conditions:
21 | *
22 | * 23 | * The above copyright notice and this permission notice shall be included in 24 | * all copies or substantial portions of the Software.
25 | *
26 | * 27 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 28 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 29 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 30 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 32 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 33 | * SOFTWARE.
34 | *
35 | * 36 | * 37 | * This software uses open-source dependencies that are listed under the 38 | * licenses - {@link Eclipse 39 | * Public License v2.0}, 40 | * {@link Apache 41 | * License 2.0}, {@link Server Side 43 | * Public License}, 44 | * {@link Mozilla Public 45 | * License 2.0} and {@link MIT 46 | * License}. Please go through the description of the licenses to understand 47 | * the usage agreement.
48 | *
49 | * 50 | * By using the license, you agree that you have read, understood and agree to 51 | * be bound by, including without any limitation by these terms and that the 52 | * entire risk as to the quality and performance of the software is with you. 53 | * 54 | */ 55 | public interface ToJson extends Serializable { 56 | 57 | default String toJson() { 58 | return pojoToJson(this, false); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/model/UninstallRequest.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.model; 2 | 3 | import java.util.Collection; 4 | 5 | import com.fasterxml.jackson.annotation.JsonProperty; 6 | 7 | import lombok.Data; 8 | 9 | /** 10 | * MIT License
11 | *
12 | * 13 | * Copyright (c) [2022] [PharmEasyEngg]
14 | *
15 | * 16 | * Permission is hereby granted, free of charge, to any person obtaining a copy 17 | * of this software and associated documentation files (the "Software"), to deal 18 | * in the Software without restriction, including without limitation the rights 19 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 | * copies of the Software, prepare derivatives of the work, and to permit 21 | * persons to whom the Software is furnished to do so, subject to the following 22 | * conditions:
23 | *
24 | * 25 | * The above copyright notice and this permission notice shall be included in 26 | * all copies or substantial portions of the Software.
27 | *
28 | * 29 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | * SOFTWARE.
36 | *
37 | * 38 | * 39 | * This software uses open-source dependencies that are listed under the 40 | * licenses - {@link Eclipse 41 | * Public License v2.0}, 42 | * {@link Apache 43 | * License 2.0}, {@link Server Side 45 | * Public License}, 46 | * {@link Mozilla Public 47 | * License 2.0} and {@link MIT 48 | * License}. Please go through the description of the licenses to understand 49 | * the usage agreement.
50 | *
51 | * 52 | * By using the license, you agree that you have read, understood and agree to 53 | * be bound by, including without any limitation by these terms and that the 54 | * entire risk as to the quality and performance of the software is with you. 55 | * 56 | */ 57 | @Data 58 | public class UninstallRequest { 59 | 60 | @JsonProperty("request_id") 61 | private String requestId; 62 | 63 | @JsonProperty("device_id") 64 | private String deviceId; 65 | 66 | private Collection packages; 67 | } 68 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/service/DeviceManagerExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.service; 2 | 3 | import org.springframework.http.HttpStatus; 4 | import org.springframework.http.ResponseEntity; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.context.request.WebRequest; 8 | 9 | import com.google.common.collect.ImmutableMap; 10 | import com.lampo.device_lab.slave.model.DeviceManagerException; 11 | 12 | import lombok.extern.slf4j.Slf4j; 13 | 14 | /** 15 | * MIT License
16 | *
17 | * 18 | * Copyright (c) [2022] [PharmEasyEngg]
19 | *
20 | * 21 | * Permission is hereby granted, free of charge, to any person obtaining a copy 22 | * of this software and associated documentation files (the "Software"), to deal 23 | * in the Software without restriction, including without limitation the rights 24 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | * copies of the Software, prepare derivatives of the work, and to permit 26 | * persons to whom the Software is furnished to do so, subject to the following 27 | * conditions:
28 | *
29 | * 30 | * The above copyright notice and this permission notice shall be included in 31 | * all copies or substantial portions of the Software.
32 | *
33 | * 34 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 35 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 39 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 40 | * SOFTWARE.
41 | *
42 | * 43 | * 44 | * This software uses open-source dependencies that are listed under the 45 | * licenses - {@link Eclipse 46 | * Public License v2.0}, 47 | * {@link Apache 48 | * License 2.0}, {@link Server Side 50 | * Public License}, 51 | * {@link Mozilla Public 52 | * License 2.0} and {@link MIT 53 | * License}. Please go through the description of the licenses to understand 54 | * the usage agreement.
55 | *
56 | * 57 | * By using the license, you agree that you have read, understood and agree to 58 | * be bound by, including without any limitation by these terms and that the 59 | * entire risk as to the quality and performance of the software is with you. 60 | * 61 | */ 62 | @Slf4j 63 | @ControllerAdvice 64 | public class DeviceManagerExceptionHandler { 65 | 66 | @ExceptionHandler(value = DeviceManagerException.class) 67 | public ResponseEntity deviceManagerExceptionHandler(DeviceManagerException ex, WebRequest request) { 68 | log.error(ex.getMessage()); 69 | return new ResponseEntity<>(ImmutableMap.of("error", ex.getMessage()), 70 | ex.getMessage().contains("auth") ? HttpStatus.UNAUTHORIZED : HttpStatus.BAD_REQUEST); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/service/OpenSTFService.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.service; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.lampo.device_lab.slave.model.HeldBy; 10 | import com.rethinkdb.RethinkDB; 11 | import com.rethinkdb.net.Connection; 12 | import com.rethinkdb.net.Result; 13 | 14 | /** 15 | * MIT License
16 | *
17 | * 18 | * Copyright (c) [2022] [PharmEasyEngg]
19 | *
20 | * 21 | * Permission is hereby granted, free of charge, to any person obtaining a copy 22 | * of this software and associated documentation files (the "Software"), to deal 23 | * in the Software without restriction, including without limitation the rights 24 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | * copies of the Software, prepare derivatives of the work, and to permit 26 | * persons to whom the Software is furnished to do so, subject to the following 27 | * conditions:
28 | *
29 | * 30 | * The above copyright notice and this permission notice shall be included in 31 | * all copies or substantial portions of the Software.
32 | *
33 | * 34 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 35 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 36 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 37 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 38 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 39 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 40 | * SOFTWARE.
41 | *
42 | * 43 | * 44 | * This software uses open-source dependencies that are listed under the 45 | * licenses - {@link Eclipse 46 | * Public License v2.0}, 47 | * {@link Apache 48 | * License 2.0}, {@link Server Side 50 | * Public License}, 51 | * {@link Mozilla Public 52 | * License 2.0} and {@link MIT 53 | * License}. Please go through the description of the licenses to understand 54 | * the usage agreement.
55 | *
56 | * 57 | * By using the license, you agree that you have read, understood and agree to 58 | * be bound by, including without any limitation by these terms and that the 59 | * entire risk as to the quality and performance of the software is with you. 60 | * 61 | */ 62 | @Service 63 | public class OpenSTFService { 64 | 65 | @Autowired 66 | private Connection connection; 67 | 68 | @SuppressWarnings("unchecked") 69 | public Map getBusyDevices() { 70 | 71 | Result result = RethinkDB.r.db("stf").table("devices").run(connection); 72 | Map devices = new HashMap<>(); 73 | result.forEach(row -> { 74 | Map _row = ((Map) row); 75 | Map owner = (Map) _row.get("owner"); 76 | if (owner != null) { 77 | String serial = (String) _row.get("serial"); 78 | devices.put(serial, new HeldBy(owner.get("name"), owner.get("email"))); 79 | } 80 | }); 81 | return devices; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /slave/src/main/java/com/lampo/device_lab/slave/utils/ProcessUtilities.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave.utils; 2 | 3 | import com.lampo.device_lab.slave.model.Platform; 4 | 5 | /** 6 | * MIT License
7 | *
8 | * 9 | * Copyright (c) [2022] [PharmEasyEngg]
10 | *
11 | * 12 | * Permission is hereby granted, free of charge, to any person obtaining a copy 13 | * of this software and associated documentation files (the "Software"), to deal 14 | * in the Software without restriction, including without limitation the rights 15 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | * copies of the Software, prepare derivatives of the work, and to permit 17 | * persons to whom the Software is furnished to do so, subject to the following 18 | * conditions:
19 | *
20 | * 21 | * The above copyright notice and this permission notice shall be included in 22 | * all copies or substantial portions of the Software.
23 | *
24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE.
32 | *
33 | * 34 | * 35 | * This software uses open-source dependencies that are listed under the 36 | * licenses - {@link Eclipse 37 | * Public License v2.0}, 38 | * {@link Apache 39 | * License 2.0}, {@link Server Side 41 | * Public License}, 42 | * {@link Mozilla Public 43 | * License 2.0} and {@link MIT 44 | * License}. Please go through the description of the licenses to understand 45 | * the usage agreement.
46 | *
47 | * 48 | * By using the license, you agree that you have read, understood and agree to 49 | * be bound by, including without any limitation by these terms and that the 50 | * entire risk as to the quality and performance of the software is with you. 51 | * 52 | */ 53 | public class ProcessUtilities { 54 | 55 | private ProcessUtilities() { 56 | } 57 | 58 | /** 59 | * This method is to kill any process listening at the given port 60 | * 61 | * @param port {@link Integer} 62 | */ 63 | public static void kill(final int port) { 64 | if (port < 1) { 65 | return; 66 | } 67 | String command = String.format( 68 | Platform.CURRENT_PLATFORM == Platform.MACINTOSH ? "lsof -nti:%s | xargs kill -9" : "fuser -k %s/tcp", 69 | port); 70 | CommandLineExecutor.exec(command); 71 | } 72 | 73 | /** 74 | * This method is to kill all processes running at the given port 75 | * 76 | * @param process {@link String} 77 | */ 78 | public static void kill(final String process) { 79 | if (CommonUtilities.isBlank(process)) { 80 | return; 81 | } 82 | String command = String.format("ps -ef | grep '%s' | awk '{print $2}' | tr -s '\\n' ' ' | xargs kill -9", 83 | process.trim()); 84 | CommandLineExecutor.exec(command); 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /slave/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | cron.check_emulators = 0 0/5 * * * ? 2 | cron.check_stf_service = 0/30 * * * * ? 3 | cron.clean_up_logs = 0 0 0 * * ? 4 | cron.device_sync = 0/10 * * * * ? 5 | cron.stf.device_sync = 0/10 * * * * ? 6 | cron.restart_adb = 0 0 2 * * ? 7 | cron.restart_emulators = 0 0 2 * * ? 8 | cron.restart_stf = 0 0 2 * * ? 9 | 10 | master.port = ${MASTER_PORT:80} 11 | master.host = ${MASTER_HOST:localhost}:${master.port} 12 | 13 | queue.password = connect 14 | queue.username = connect 15 | 16 | stf.enabled = true 17 | restart_emulator.enabled = false 18 | restart_adb.enabled = false 19 | 20 | server.error.include-stacktrace = NEVER 21 | server.port = 5353 22 | server.servlet.context-path = 23 | 24 | slave.auth_token = bW9iaWxlIGRldmljZSBsYWIgYXV0aCB0b2tlbg== 25 | 26 | unallocate.reboot_emualators = true 27 | -------------------------------------------------------------------------------- /slave/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 6 | 7 | 8 | 9 | 11 | logs/slave.log 12 | 14 | logs/slave-%d{yyyy-MM-dd}.%i.log.gz 15 | 16 | 10MB 17 | 30 18 | 10GB 19 | 20 | 21 | %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /slave/src/main/resources/scripts/stf.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | 6 | if [ -f ~/.bash_profile ]; then source ~/.bash_profile; fi 7 | if [ -f ~/.bashrc ]; then source ~/.bashrc; fi 8 | if [ -f ~/.profile ]; then source ~/.profile; fi 9 | if [ -f ~/.zshrc ]; then source ~/.zshrc; fi 10 | 11 | node_version="8.16.1" 12 | 13 | ip=$1 14 | quality=$2 15 | 16 | cmd="nvm use --delete-prefix v$node_version --silent &>/dev/null && export SCREEN_JPEG_QUALITY=$quality && stf local --public-ip $ip &> stf.log 2>&1 < /dev/null &" 17 | echo "executing cmd => $cmd" 18 | eval $cmd 19 | 20 | disown -------------------------------------------------------------------------------- /slave/src/main/resources/scripts/wd-session.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set +e 4 | 5 | if [ -f ~/.bash_profile ]; then source ~/.bash_profile; fi 6 | if [ -f ~/.bashrc ]; then source ~/.bashrc; fi 7 | if [ -f ~/.profile ]; then source ~/.profile; fi 8 | if [ -f ~/.zshrc ]; then source ~/.zshrc; fi 9 | 10 | node_version="14.5.0" 11 | 12 | java_home="$1" 13 | android_home="$2" 14 | appium_cmd="${@:3}" 15 | 16 | cmd="nvm use --delete-prefix v$node_version --silent &>/dev/null && export ANDROID_HOME=\"$android_home\" && export JAVA_HOME=\"$java_home\" && appium $appium_cmd" 17 | echo "executing cmd => $cmd" 18 | eval $cmd 19 | 20 | disown -------------------------------------------------------------------------------- /slave/src/test/java/com/lampo/device_lab/slave/SlaveApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.lampo.device_lab.slave; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SlaveApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | --------------------------------------------------------------------------------