different drivers

This commit is contained in:
Anton Romanov 2019-06-06 17:07:25 +04:00
parent dc467ec72c
commit 59e52aaf4a
5 changed files with 25 additions and 7 deletions

View File

@ -18,6 +18,6 @@ fi
ssh $USERSERVER "cd /tmp && rm -rf $ARTIFACT_NAME*.jar && echo `date` 'killed' >> log_$ARTIFACT_NAME"
scp build/libs/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar $USERSERVER:/tmp/$ARTIFACT_NAME-0.1.0-SNAPSHOT.jar
ssh $USERSERVER -f "cd /tmp/ && /opt/jdk1.8.0_192/bin/java -jar $ARTIFACT_NAME-0.1.0-SNAPSHOT.jar -Xms 512m -Xmx 1024m --server.port=8443 --server.http.port=8080 --ng-tracker.base-url=http://193.110.3.124:8080 --ng-tracker.dev-mode=false >> /home/user/logfile_$ARTIFACT_NAME" &
ssh $USERSERVER -f "cd /tmp/ && /opt/jdk1.8.0_192/bin/java -jar $ARTIFACT_NAME-0.1.0-SNAPSHOT.jar -Xms 512m -Xmx 1024m --server.port=8443 --server.http.port=8080 --ng-tracker.base-url=http://193.110.3.124:8080 --ng-tracker.dev-mode=false --ng-tracker.driver-path=/home/user >> /home/user/logfile_$ARTIFACT_NAME" &
sleep 10
echo "is deployed"

View File

@ -23,6 +23,8 @@ public class ApplicationProperties {
private String debugEmail;
private String driverPath;
public boolean isUseHttps() {
return useHttps;
}
@ -70,4 +72,12 @@ public class ApplicationProperties {
public void setDebugEmail(String debugEmail) {
this.debugEmail = debugEmail;
}
public String getDriverPath() {
return driverPath;
}
public void setDriverPath(String driverPath) {
this.driverPath = driverPath;
}
}

View File

@ -5,16 +5,20 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.springframework.stereotype.Service;
import ru.ulstu.configuration.ApplicationProperties;
import ru.ulstu.grant.model.GrantDto;
import ru.ulstu.grant.page.KiasPage;
import ru.ulstu.user.service.UserService;
import java.nio.file.Paths;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import static org.apache.commons.lang3.StringUtils.isEmpty;
@Service
public class KiasService {
private final static String BASE_URL = "https://www.rfbr.ru/rffi/ru/contest_search?CONTEST_STATUS_ID=%s&CONTEST_TYPE=%s&CONTEST_YEAR=%s";
@ -27,9 +31,12 @@ public class KiasService {
private final static String DRIVER_TYPE = "webdriver.chrome.driver";
private final UserService userService;
private final ApplicationProperties applicationProperties;
public KiasService(UserService userService) {
public KiasService(UserService userService,
ApplicationProperties applicationProperties) {
this.userService = userService;
this.applicationProperties = applicationProperties;
}
public List<GrantDto> getNewGrantsDto() throws ParseException {
@ -78,8 +85,10 @@ public class KiasService {
}
private String getDriverExecutablePath() {
return KiasService.class.getClassLoader().getResource(
String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile();
return isEmpty(applicationProperties.getDriverPath())
? KiasService.class.getClassLoader()
.getResource(String.format(DRIVER_LOCATION, getDriverExecutable(isWindows()))).getFile()
: Paths.get(applicationProperties.getDriverPath(), getDriverExecutable(isWindows())).toString();
}
private String getDriverExecutable(boolean isWindows) {

View File

@ -37,4 +37,5 @@ ng-tracker.undead-user-login=admin
ng-tracker.dev-mode=true
ng-tracker.debug_email=
ng-tracker.use-https=false
ng-tracker.check-run=false
ng-tracker.check-run=false
ng-tracker.driver-path=

View File

@ -6,8 +6,6 @@ import org.openqa.selenium.WebDriver;
import java.util.concurrent.TimeUnit;
//import org.openqa.selenium.support.PageFactory;
public abstract class Context {
private final static String DRIVER_LOCATION = "drivers/%s";