Skip to content

Commit

Permalink
Merged developer into master
Browse files Browse the repository at this point in the history
  • Loading branch information
abainczyk committed Feb 3, 2017
2 parents 2247ef9 + 080c4ea commit 0fee61f
Show file tree
Hide file tree
Showing 279 changed files with 4,553 additions and 3,734 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# ALEX v1.2.1

## Breaking Changes

* Actions that deal with web elements have to be updated:

```
node: {selector: '...', type: 'CSS|XPATH'}
```

## Features

* New actions:
* Set a variable by node count
* Set a variable by regex
* Switch between XPath and CSS selectors in actions
* Experimental parallel test execution support

# ALEX v1.2

## Features
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.learnlib.alex</groupId>
<artifactId>alex-parent</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package de.learnlib.alex.algorithms;

import de.learnlib.api.LearningAlgorithm;
import de.learnlib.oracles.SULOracle;
import de.learnlib.api.MembershipOracle;
import net.automatalib.words.Alphabet;
import net.automatalib.words.Word;

/**
* Interface to describe how a new Learner will be created.
Expand All @@ -33,17 +34,20 @@ public interface LearnAlgorithmFactory {
* The Alphabet to use.
* @param oracle
* The MQ oracle.
*
* @return A new Learner.
*/
LearningAlgorithm.MealyLearner<String, String> createLearner(Alphabet<String> sigma,
SULOracle<String, String> oracle);
LearningAlgorithm.MealyLearner<String, String> createLearner(
Alphabet<String> sigma, MembershipOracle<String, Word<String>> oracle);

/**
* Read the internal data of an algorithm.
*
* @param learner
* The learner to extract the internal data from.
*
* @return The internal data as a nice JSON string.
*
* @throws IllegalArgumentException
* If the algorithm has the wrong type or no internal data.
*/
Expand Down
7 changes: 6 additions & 1 deletion main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>de.learnlib.alex</groupId>
<artifactId>alex-parent</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -199,6 +199,11 @@
<artifactId>htmlunit-driver</artifactId>
<version>${htmlunitdriver.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion main/src/main/java/de/learnlib/alex/ALEXApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,18 @@ public void findAlgorithms() {
LOGGER.info("{} LearnAlgorithms found.", algorithms.size());
}

/**
* HTTP request filter that is required for the {@link IFrameProxyResource} to work properly.
*
* @return The filter.
*/
@Bean
public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
return new HiddenHttpMethodFilter() {
@Override
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain filterChain) throws ServletException, IOException {
if ("POST".equals(request.getMethod())
if (request.getMethod().equals("POST")
&& request.getContentType().equals(MediaType.APPLICATION_FORM_URLENCODED_VALUE)) {
filterChain.doFilter(request, response);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import de.learnlib.alex.core.entities.ExecuteResult;
import de.learnlib.alex.core.entities.IdRevisionPair;
import de.learnlib.alex.core.entities.Symbol;
import de.learnlib.alex.core.entities.SymbolAction;
import de.learnlib.alex.core.learner.connectors.ConnectorManager;
Expand Down Expand Up @@ -58,7 +57,7 @@ public class ExecuteSymbolAction extends SymbolAction {
*/
@Transient
@JsonProperty("symbolToExecute")
private IdRevisionPair symbolToExecuteAsIdRevisionPair;
private Long symbolToExecuteAsId;

/**
* The actual reference to the Symbol that will be executed.
Expand All @@ -68,31 +67,26 @@ public class ExecuteSymbolAction extends SymbolAction {
@JsonIgnore
private Symbol symbolToExecute;

/**
* Indicates if the latest revision of the symbol should be used.
*/
private boolean useLatestRevision;

/**
* Get the reference to the Symbol which will be executed.
*
* @return The reference as IdRevisionPair. Just add the project id ;)
*/
public IdRevisionPair getSymbolToExecuteAsIdRevisionPair() {
if (symbolToExecuteAsIdRevisionPair == null) {
return new IdRevisionPair(symbolToExecute);
public Long getSymbolToExecuteAsId() {
if (symbolToExecuteAsId == null) {
return symbolToExecute.getId();
}
return symbolToExecuteAsIdRevisionPair;
return symbolToExecuteAsId;
}

/**
* Set a new reference to the Symbol to execute.
* This does not update the actual Symbol!
*
* @param symbolToExecuteAsIdRevisionPair The new IdRevisionPair of the Symbol to execute.
* @param symbolToExecuteAsId The new id of the Symbol to execute.
*/
public void setSymbolToExecuteAsIdRevisionPair(IdRevisionPair symbolToExecuteAsIdRevisionPair) {
this.symbolToExecuteAsIdRevisionPair = symbolToExecuteAsIdRevisionPair;
public void setSymbolToExecuteAsId(Long symbolToExecuteAsId) {
this.symbolToExecuteAsId = symbolToExecuteAsId;
}

/**
Expand Down Expand Up @@ -129,33 +123,15 @@ public String getSymbolToExecuteName() {
return symbolToExecute.getName();
}

/**
* Checks if the latest revision of the symbols should be used.
*
* @return if the latest revision should be used.
*/
public boolean isUseLatestRevision() {
return useLatestRevision;
}

/**
* Sets the flag that indicates if the latest revision of the symbol should be used.
*
* @param useLatestRevision the flag
*/
public void setUseLatestRevision(boolean useLatestRevision) {
this.useLatestRevision = useLatestRevision;
}

@Override
public ExecuteResult execute(ConnectorManager connector) {
if (symbolToExecute == null) {
LOGGER.info(LEARNER_MARKER, "No other Symbol to execute was set (ignoreFailure: {}, negated: {}).",
ignoreFailure, negated);
return getFailedOutput();
}
LOGGER.info(LEARNER_MARKER, "Executing other Symbol <{}:{}> (ignoreFailure: {}, negated: {}).",
symbolToExecute.getId(), symbolToExecute.getRevision(), ignoreFailure, negated);
LOGGER.info(LEARNER_MARKER, "Executing other Symbol <{}> (ignoreFailure: {}, negated: {}).",
symbolToExecute.getId(), ignoreFailure, negated);
if (LOGGER.isEnabled(Level.INFO, LEARNER_MARKER)) {
LoggerUtil.increaseIndent();
}
Expand All @@ -165,8 +141,8 @@ public ExecuteResult execute(ConnectorManager connector) {
if (LOGGER.isEnabled(Level.INFO, LEARNER_MARKER)) {
LoggerUtil.decreaseIndent();
}
LOGGER.info(LEARNER_MARKER, "Executed other Symbol <{}:{}> => {} (ignoreFailure: {}, negated: {}).",
symbolToExecute.getId(), symbolToExecute.getRevision(), symbolResult, ignoreFailure, negated);
LOGGER.info(LEARNER_MARKER, "Executed other Symbol <{}> => {} (ignoreFailure: {}, negated: {}).",
symbolToExecute.getId(), symbolResult, ignoreFailure, negated);
if (symbolResult == ExecuteResult.OK) {
return getSuccessOutput();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,57 @@ public TestResult testRequest(String baseUrl) {
* The result object for the {@link #testRequest(String)} method.
*/
public static class TestResult {
public int status;
public String body;
public Map<String, String> cookies = new HashMap<>();
public Map<String, String> headers = new HashMap<>();

/** The status of the HTTP response. */
private int status;

/** The body of the HTTP response. */
private String body;

/** The cookies of the HTTP response. */
private Map<String, String> cookies = new HashMap<>();

/** The headers of the HTTP response. */
private Map<String, String> headers = new HashMap<>();

/** @return The status. */
public int getStatus() {
return status;
}

/** @param status The status. */
public void setStatus(int status) {
this.status = status;
}

/** @return The body. */
public String getBody() {
return body;
}

/** @param body The body. */
public void setBody(String body) {
this.body = body;
}

/** @return The cookies. */
public Map<String, String> getCookies() {
return cookies;
}

/** @param cookies The cookies. */
public void setCookies(Map<String, String> cookies) {
this.cookies = cookies;
}

/** @return The header. */
public Map<String, String> getHeaders() {
return headers;
}

/** @param headers The headers. */
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public void setOperator(Operator assertMethod) {
@Override
protected ExecuteResult execute(ConnectorManager connector) {
CounterStoreConnector storeConnector = connector.getConnector(CounterStoreConnector.class);
Integer counterValue = storeConnector.get(getUser().getId(), project.getId(), name);
Integer counterValue = storeConnector.get(name);
boolean result;

switch (operator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.validation.constraints.NotNull;

/**
* Increment a counter by 1.
Expand All @@ -46,32 +47,37 @@ public class IncrementCounterAction extends SymbolAction {
@NotBlank
private String name;

/**
* Get the name of the counter.
*
* @return The counter name.
*/
/** The value by which the counter should be incremented. */
@NotNull
private int incrementBy;

@Override
public ExecuteResult execute(ConnectorManager connector) {
CounterStoreConnector counterConnector = connector.getConnector(CounterStoreConnector.class);
counterConnector.incrementBy(getUser().getId(), project.getId(), name, incrementBy);

LOGGER.info(LEARNER_MARKER, "Incremented counter '{}' by '{}' (ignoreFailure: {}, negated: {}).",
name, incrementBy, ignoreFailure, negated);
return getSuccessOutput();
}

/** @return {@link #name}. */
public String getName() {
return name;
}

/**
* Set a new counter by its name.
*
* @param name
* The new name of the counter to use.
*/
/** @param name {@link #name}. */
public void setName(String name) {
this.name = name;
}

@Override
public ExecuteResult execute(ConnectorManager connector) {
CounterStoreConnector storeConnector = connector.getConnector(CounterStoreConnector.class);
storeConnector.increment(user.getId(), project.getId(), name);
/** @return {@link #incrementBy}. */
public int getIncrementBy() {
return incrementBy;
}

LOGGER.info(LEARNER_MARKER, "Incremented counter '{}' (ignoreFailure: {}, negated: {}).",
name, ignoreFailure, negated);
return getSuccessOutput();
/** @param incrementBy {@link #incrementBy}. */
public void setIncrementBy(int incrementBy) {
this.incrementBy = incrementBy;
}
}
Loading

0 comments on commit 0fee61f

Please sign in to comment.