Skip to content

Commit

Permalink
ADD some changes in srodinger.properties and configuration, experimen…
Browse files Browse the repository at this point in the history
…ts with spring boot
  • Loading branch information
matusmacik committed Jul 12, 2018
1 parent 010856d commit 611c038
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -18,4 +18,5 @@ dependency-reduced-pom.xml

.DS_Store

tools/schrodinger/build
tools/schrodinger/build
testing/schrodingertest/build
59 changes: 58 additions & 1 deletion testing/schrodingertest/pom.xml
Expand Up @@ -21,12 +21,16 @@
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<dependency>
<groupId>com.evolveum.midpoint.tools</groupId>
<artifactId>schrodinger</artifactId>
<version>3.9-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
Expand All @@ -50,6 +54,11 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
Expand All @@ -67,6 +76,18 @@
</exclusions>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.evolveum.midpoint</groupId>
<artifactId>midpoint-war-layout</artifactId>
<version>${project.version}</version>

<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

<!--possibly some obsolete begin -->
Expand Down Expand Up @@ -128,10 +149,46 @@
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>

</dependencies>
</dependencyManagement>

<!--possibly obsolete end -->

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring.boot.version}</version>

<configuration>
<mainClass>com.evolveum.midpoint.web.boot.MidPointSpringApplication</mainClass>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.evolveum.midpoint.gui</groupId>
<artifactId>admin-gui</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

</project>
Expand Up @@ -40,10 +40,10 @@
@Listeners({BrowserPerClass.class})
public abstract class TestBase {

public static final String BASE_URL = "http://localhost:8080/midpoint";
//public static final String BASE_URL = "http://localhost:8080/midpoint";

public static final String USERNAME = "administrator";
public static final String PASSWORD = "5ecr3t";
//public static final String USERNAME = "administrator";
//public static final String PASSWORD = "5ecr3t";

public static final String PROPERTY_NAME_MIDPOINT_HOME = "-Dmidpoint.home";

Expand All @@ -53,17 +53,27 @@ public abstract class TestBase {
protected MidPoint midPoint;
protected BasicPage basicPage;


@BeforeClass
public void beforeClass() throws IOException {
LOG.info("Starting tests in class {}", getClass().getName());

EnvironmentConfiguration config = new EnvironmentConfiguration();
config.baseUrl(BASE_URL);
//config.baseUrl(BASE_URL);

if (midPoint !=null){

}else{

EnvironmentConfiguration config = new EnvironmentConfiguration();
midPoint = new MidPoint(config);

}

LoginPage login = midPoint.login();
basicPage = login.login(USERNAME, PASSWORD);


basicPage = login.login(midPoint.getUsername(),midPoint.getPassword());

}

@AfterClass
Expand Down
@@ -0,0 +1,55 @@
package com.evolveum.midpoint.testing.schrodinger;

import com.evolveum.midpoint.schrodinger.EnvironmentConfiguration;
import com.evolveum.midpoint.schrodinger.MidPoint;

import org.apache.commons.lang3.ArrayUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;

import java.io.IOException;


/**
* Created by matus on 7/10/2018.
*/
public class TestSuiteConfig extends TestBase {

private static final Logger LOG = LoggerFactory.getLogger(TestSuiteConfig.class);

@BeforeSuite
public void init() throws IOException {

EnvironmentConfiguration config = new EnvironmentConfiguration();
midPoint = new MidPoint(config);
String[] s= {"start"};
// try {
// MidPointWarLauncher.start(s);
//
// } catch (Exception e) {
// //TODO handle the right way
//
// LOG.debug("The application state: "+ e.getMessage());
// }

LOG.debug("The application state: "+ ArrayUtils.toString(s));

}

@AfterSuite
public void cleanUp() {
String[] s= {"stop"};
// try {
// MidPointWarLauncher.main(s);
// } catch (Exception e) {
// //TODO handle the right way
// e.printStackTrace();
// }


LOG.debug("The application state: "+ ArrayUtils.toString(s));
}
}
@@ -1,2 +1,5 @@
username=administrator
password=5ecr3t
base_url=http://localhost:8080/midpoint
webdriver=webdriver.chrome.driver
webdriverLocation=C:\\Users\\matus\\chromedriver\\chromedriver.exe
Expand Up @@ -45,6 +45,6 @@
<logger name="com.gargoylesoftware.htmlunit.html.HtmlScript" level="OFF"/>

<logger name="com.evolveum.midpoint.schrodinger" level="DEBUG"/>

<logger name="com.evolveum.midpoint.testing.schrodinger" level="DEBUG"/>
</configuration>

6 changes: 6 additions & 0 deletions testing/schrodingertest/testng-integration.xml
Expand Up @@ -16,4 +16,10 @@
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="integration" parallel="false" verbose="1">
<test name="Schrodinger" preserve-order="true" parallel="false" verbose="10" enabled="true">
<classes>
<class name="com.evolveum.midpoint.testing.schrodinger.TestSuiteConfig"/>
<class name="com.evolveum.midpoint.testing.schrodinger.scenarios.UserPhotoTests"/>
</classes>
</test>
</suite>
6 changes: 1 addition & 5 deletions testing/schrodingertest/testng-unit.xml
Expand Up @@ -16,9 +16,5 @@
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="unit" parallel="false" verbose="1">
<test name="Schrodinger" preserve-order="true" parallel="false" verbose="10" enabled="true">
+ <classes>
+ <class name="com.evolveum.midpoint.testing.schrodinger.scenarios.UserPhotoTests"/>
+ </classes>
+ </test>

</suite>
Expand Up @@ -24,6 +24,10 @@ public class MidPoint {

private static final String SCHRODINGER_PROPERTIES = "../../testing/schrodingertest/src/test/resources/configuration/schrodinger.properties";

private String username;
private String password;

private String baseUrl;
private String webDriver;
private String webdriverLocation;

Expand All @@ -36,8 +40,10 @@ public MidPoint(EnvironmentConfiguration environment) throws IOException {
}

private void init() throws IOException {
environment.validate();
fetchProperties();
environment.baseUrl(baseUrl);
environment.validate();


System.setProperty(webDriver, webdriverLocation);
System.setProperty("selenide.browser", environment.getDriver().name().toLowerCase());
Expand Down Expand Up @@ -67,9 +73,23 @@ private void fetchProperties() throws IOException {

webDriver = schrodingerProperties.getProperty("webdriver");
webdriverLocation = schrodingerProperties.getProperty("webdriverLocation");
username = schrodingerProperties.getProperty("username");
password = schrodingerProperties.getProperty("password");
baseUrl = schrodingerProperties.getProperty("base_url");


} catch (IOException e) {
throw new IOException("An exception was thrown during Schrodinger initialization " + e.getLocalizedMessage());
}
}

public String getPassword(){

return this.password;
}

public String getUsername(){

return this.username;
}
}

0 comments on commit 611c038

Please sign in to comment.