Skip to content

Commit

Permalink
Merge pull request #337 from Cognifide/feature/rerun
Browse files Browse the repository at this point in the history
Rerun one test / Rerun suite
  • Loading branch information
plutasnyy authored Oct 2, 2018
2 parents fce9af0 + 37c8079 commit dedc37c
Show file tree
Hide file tree
Showing 84 changed files with 3,157 additions and 517 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to AET will be documented in this file.
## Unreleased
**List of changes that are finished but not yet released in any final version.**

- [PR-337](https://github.com/Cognifide/aet/pull/337) Added rerun one test or whole suite

## Version 3.0.0


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.cognifide.aet.communication.api.execution;

import com.cognifide.aet.communication.api.messages.FullProgressLog;
import org.apache.commons.lang3.StringUtils;

/**
Expand All @@ -26,13 +27,20 @@ public class SuiteStatusResult {

private String message;

private FullProgressLog progressLog;

public SuiteStatusResult(ProcessingStatus status) {
this(status, StringUtils.EMPTY);
}

public SuiteStatusResult(ProcessingStatus status, String message) {
this(status, message, null);
}

public SuiteStatusResult(ProcessingStatus status, String message, FullProgressLog progressLog) {
this.status = status;
this.message = message;
this.progressLog = progressLog;
}

/**
Expand All @@ -48,4 +56,8 @@ public ProcessingStatus getStatus() {
public String getMessage() {
return message;
}

public FullProgressLog getProgressLog() {
return progressLog;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ public class CollectorJobData extends JobData {
* @param preferredBrowserId - id of preferred browser or null if the default one should be used
*/
public CollectorJobData(String company, String project, String suiteName, String testName,
List<Url> urls,
String proxy, String preferredBrowserId) {
List<Url> urls, String proxy, String preferredBrowserId) {
super(company, project, suiteName, testName);
this.urls = urls;
this.proxy = proxy;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/**
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.cognifide.aet.communication.api.messages;

import java.io.Serializable;
import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;

public class FullProgressLog implements Serializable {

private static final long serialVersionUID = -7331561874304014158L;

private ProgressLog compareLog;
private ProgressLog collectLog;

public FullProgressLog(ProgressLog collectLog, ProgressLog compareLog) {
this.collectLog = collectLog;
this.compareLog = compareLog;
}

public ProgressLog getCompareLog() {
return compareLog;
}

public ProgressLog getCollectLog() {
return collectLog;
}

@Override
public String toString() {
return StringUtils.join(Arrays.asList(compareLog, collectLog), " ::: ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.cognifide.aet.runner.processing;
package com.cognifide.aet.communication.api.messages;

public class ProgressLog {
import java.io.Serializable;

public class ProgressLog implements Serializable {

private static final long serialVersionUID = -3480689780301447508L;

private final String name;

private final int receivedMessagesSuccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
/**
* Basic message used to send work progress via JMS.
*/
public class ProgressMessage extends TaskMessage<String> {

private static final long serialVersionUID = 490908210242015178L;
public class ProgressMessage extends TaskMessage<FullProgressLog> {
private static final long serialVersionUID = -428855447599621022L;

/**
* @param message - progress message.
*/
public ProgressMessage(String message) {
public ProgressMessage(FullProgressLog message) {
super(MessageType.PROGRESS, message);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
import java.util.List;
import java.util.Collections;

public class Comparator extends Operation implements Commentable, Named {

Expand All @@ -30,7 +31,7 @@ public class Comparator extends Operation implements Commentable, Named {

private ComparatorStepResult stepResult;

private final List<Operation> filters = new ArrayList<>();
private List<Operation> filters = new ArrayList<>();

private String comment;

Expand All @@ -49,6 +50,9 @@ public void setStepResult(ComparatorStepResult stepResult) {
}

public List<Operation> getFilters() {
if(filters == null){
return Collections.emptyList();
}
return ImmutableList.copyOf(filters);
}

Expand All @@ -68,6 +72,10 @@ public void setStatistics(Statistics statistics) {
this.statistics = statistics;
}

public void setFilters(List<Operation> filters) {
this.filters = filters;
}

@Override
public void setComment(String comment) {
this.comment = comment;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package com.cognifide.aet.communication.api.metadata;

public enum RunType {
SUITE,
TEST,
URL,
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.Valid;
Expand All @@ -43,7 +44,8 @@

public class Suite implements Serializable, Commentable, Named, Validatable {

private static final long serialVersionUID = 3602287822306302730L;
private static final long serialVersionUID = -3225670696134184553L;

private static final Gson GSON_FOR_JSON = new GsonBuilder()
.registerTypeHierarchyAdapter(Collection.class, new CollectionSerializer())
.registerTypeHierarchyAdapter(Map.class, new MapSerializer())
Expand All @@ -52,8 +54,12 @@ public class Suite implements Serializable, Commentable, Named, Validatable {
private static final Type SUITE_TYPE = new TypeToken<Suite>() {
}.getType();

public void setCorrelationId(String correlationId) {
this.correlationId = correlationId;
}

@NotBlank
private final String correlationId;
private String correlationId;

@NotBlank
@Size(max = 30)
Expand Down Expand Up @@ -130,6 +136,17 @@ public List<Test> getTests() {
return tests;
}

public Optional<Test> getTest(String testName){
Test testToReturn = null;
for (Test test: this.tests) {
if(test.getName().equals(testName)){
testToReturn = test;
break;
}
}
return Optional.ofNullable(testToReturn);
}

public boolean addTest(Test test) {
return tests.add(test);
}
Expand Down Expand Up @@ -191,7 +208,7 @@ public String toString() {
.toString();
}

public void setVersion(long version) {
public void setVersion(Long version) {
this.version = version;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@
import com.google.common.base.MoreObjects;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.NotBlank;

public class Test implements Serializable, Commentable, Named {

private static final long serialVersionUID = -220660503633061510L;
private static final long serialVersionUID = 6761670624207862805L;

@NotBlank
private final String name;
Expand All @@ -38,7 +39,7 @@ public class Test implements Serializable, Commentable, Named {

@Valid
@NotNull(message = "Test must have at least one url")
private final Set<Url> urls = new HashSet<>();
private Set<Url> urls = new HashSet<>();

/**
* @param name - name of a test
Expand Down Expand Up @@ -115,4 +116,25 @@ public String toString() {
.add("name", name)
.toString();
}

public Optional<Url> getUrl(String urlName) {
Url urlToReturn = null;
for (Url url: this.urls) {
if(url.getName().equals(urlName)){
urlToReturn = url;
break;
}
}
return Optional.ofNullable(urlToReturn);
}

public void setUrls(Set<Url> urls) {
this.urls = urls;
}

public void setRerunUrls() {
for (Url url: this.urls) {
url.setReran();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package com.cognifide.aet.communication.api.metadata;

import com.cognifide.aet.communication.api.metadata.Suite.Timestamp;
import com.google.common.base.MoreObjects;
import java.io.Serializable;
import java.util.ArrayList;
Expand All @@ -25,7 +26,7 @@

public class Url implements Serializable, Commentable, Named {

private static final long serialVersionUID = -8235442513988955778L;
private static final long serialVersionUID = -8223780516461495807L;

@NotBlank
private final String name;
Expand All @@ -45,6 +46,10 @@ public class Url implements Serializable, Commentable, Named {
@NotNull
private final List<Step> steps = new ArrayList<>();

private boolean isReran;

private Timestamp rerunTimestamp;

public Url(String name, String url, String domain) {
this.name = name;
this.url = url;
Expand Down Expand Up @@ -123,4 +128,10 @@ public boolean equals(Object o) {
public int hashCode() {
return java.util.Objects.hash(name);
}

public void setReran() {
isReran = true;
rerunTimestamp = new Timestamp(System.currentTimeMillis());
}

}
Loading

0 comments on commit dedc37c

Please sign in to comment.