Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rerun one test / Rerun suite #337

Merged
merged 162 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
162 commits
Select commit Hold shift + click to select a range
a381d76
start work with rerun, create base for new servlet
plutasnyy Aug 16, 2018
386273c
restored old annotataions, add register servlet
plutasnyy Aug 20, 2018
1526443
prototype
PiteroS678 Aug 20, 2018
2e096a5
communication front - back
PiteroS678 Aug 20, 2018
010593b
added test to payload
PiteroS678 Aug 20, 2018
a6198eb
first version of endpoint to execute rerun
plutasnyy Aug 20, 2018
556f061
merge
plutasnyy Aug 20, 2018
e0bd59b
restored addCors in suite rerun srvlet
plutasnyy Aug 20, 2018
fbd14d9
communication front - back refactor
PiteroS678 Aug 20, 2018
956dcfa
work on rerun servlet
plutasnyy Aug 21, 2018
278d22b
Merge branch 'feature/rerun' of https://github.com/Cognifide/aet into…
plutasnyy Aug 21, 2018
c22ccee
upadted suite executor
plutasnyy Aug 21, 2018
f9d9660
cleared data in received suite
plutasnyy Aug 21, 2018
aa1d99d
small refactor to make servlet human readable
plutasnyy Aug 21, 2018
fd39331
added replacing test in database
plutasnyy Aug 21, 2018
20395cb
refactor
PiteroS678 Aug 22, 2018
48c1563
refactor
PiteroS678 Aug 22, 2018
b421341
license & refactor
PiteroS678 Aug 22, 2018
73b0abd
annotations fix
PiteroS678 Aug 22, 2018
6715f59
SuiteRerun update
PiteroS678 Aug 22, 2018
988f255
fixed clean daara from suite
plutasnyy Aug 22, 2018
c020d2f
changed overriding one test in mongo db from remove and add operation…
plutasnyy Aug 22, 2018
d4b3350
merged with master, updated annotations to 6.0
plutasnyy Aug 23, 2018
f7ca219
removed scr from rest-endpoint and resolved conflicts
plutasnyy Aug 23, 2018
bdf2fb9
merged with history and resolved conflicts
plutasnyy Aug 23, 2018
0765aae
added gson object in reponseAsJson calls
plutasnyy Aug 23, 2018
deb4cc9
resolved conflicts
plutasnyy Aug 23, 2018
140869e
rerun all tests
PiteroS678 Aug 23, 2018
0e9c74a
Merge branch 'feature/rerun' of https://github.com/Cognifide/aet into…
PiteroS678 Aug 23, 2018
fb8e612
rerun button on suite level
PiteroS678 Aug 23, 2018
a00b8a1
rerun button is now properly linked to function
PiteroS678 Aug 23, 2018
130a76b
Added response to client
PiteroS678 Aug 23, 2018
ea87d9d
New correlationId & timestamp for suite
PiteroS678 Aug 23, 2018
89410ae
refresh fix
PiteroS678 Aug 24, 2018
0af1cef
removed blank line
plutasnyy Aug 28, 2018
c5d11b1
updated description in metadataDAO
plutasnyy Aug 28, 2018
586cf82
renamed accesibility suite in partials
plutasnyy Aug 28, 2018
87f6567
removed blank line
plutasnyy Aug 28, 2018
b72b6ae
add information about rerun to test
plutasnyy Aug 28, 2018
e22bb69
updated changelog
plutasnyy Aug 28, 2018
ce37513
reoreded functions in suite class
plutasnyy Aug 29, 2018
91f2305
created decorator pattern for rerun - suite/test/url wrappers
plutasnyy Aug 29, 2018
71c089a
moved wrappers to API module
plutasnyy Aug 30, 2018
82f76e0
craeted interface for strategy
plutasnyy Aug 30, 2018
bdc4bd0
prepared abstarctuion for strategy
plutasnyy Aug 30, 2018
f88ab76
Merge branch 'master' of https://github.com/Cognifide/aet into featur…
tkaik Aug 30, 2018
2b1c330
started work with runner
plutasnyy Aug 30, 2018
521428a
SuiteStatus servlet returns more detailed progress info
tkaik Aug 30, 2018
d7d2fd1
Added rerun status message
Aug 30, 2018
efd6fb2
Fixed reversed compare/collect progress log variables
tkaik Aug 30, 2018
374153f
first working version with new messages in runner
plutasnyy Aug 30, 2018
831ec35
Merge branch 'feature/rerun' of https://github.com/Cognifide/aet into…
plutasnyy Aug 30, 2018
bdee2da
merge
plutasnyy Aug 30, 2018
f443d1c
merge2
plutasnyy Aug 30, 2018
c500017
moved cleaning url direct to RunIndexWrapper
plutasnyy Aug 31, 2018
da0a5b9
add test rerun
plutasnyy Aug 31, 2018
ce07e0b
started work with url rerun
plutasnyy Aug 31, 2018
ad8b522
added rerun one url
plutasnyy Aug 31, 2018
02876c2
testUrl param now has no unicode characters
Aug 31, 2018
5e56e20
added skiping tests
plutasnyy Aug 31, 2018
cb735c3
Merge remote-tracking branch 'origin/feature/rerun' into feature/reru…
plutasnyy Aug 31, 2018
837feb0
removed consolelog
plutasnyy Aug 31, 2018
a59978f
cleaned after rename
plutasnyy Aug 31, 2018
09d6672
more cleaning
plutasnyy Aug 31, 2018
58fd3a3
fixed url for gulp
plutasnyy Aug 31, 2018
50e368d
changed runindexwrapper to factory
plutasnyy Sep 3, 2018
b2a0afd
removed ignore
plutasnyy Sep 3, 2018
93e9436
added dafault value count urls to solve test
plutasnyy Sep 3, 2018
1d6be4e
removed ignore:
plutasnyy Sep 3, 2018
fa10a6e
refactor tests in collect dispatchet test
plutasnyy Sep 3, 2018
5450a7c
removed unused functions
plutasnyy Sep 3, 2018
72b58a8
small refactor in suite rerun
plutasnyy Sep 3, 2018
4c1bcd7
fixed incorrect extension in suite rerun functions
plutasnyy Sep 3, 2018
9a4b71f
fixed gramars
plutasnyy Sep 3, 2018
6ec9096
renamed variables indexedSuite on runIndexWrapper
plutasnyy Sep 4, 2018
79ec038
Merge remote-tracking branch 'origin/master' into feature/rerun-chang…
plutasnyy Sep 4, 2018
a6701df
Merge branch 'feature/rerun' of https://github.com/Cognifide/aet into…
plutasnyy Sep 4, 2018
1146fa3
Merge remote-tracking branch 'origin/master' into feature/rerun
plutasnyy Sep 4, 2018
4972647
Merge branch 'feature/rerun-change-way-to-execute-suite' into feature…
plutasnyy Sep 4, 2018
edd6c5d
refactor processor strategy
plutasnyy Sep 7, 2018
7be20ba
cleaning in suite execution processor strategy
plutasnyy Sep 7, 2018
231ea33
created files for processors tests
plutasnyy Sep 7, 2018
520402d
add tests for run index wrapper
plutasnyy Sep 7, 2018
23bda3a
added test for url run index wrapper
plutasnyy Sep 7, 2018
9b338cd
add tests for test run index wrapper
plutasnyy Sep 7, 2018
54e7c3f
added test for suite suite run index wrapper
plutasnyy Sep 7, 2018
883f833
updated tests for run index wrapper
plutasnyy Sep 7, 2018
c5f892c
moved strategies to directory created specially for theirs
plutasnyy Sep 7, 2018
a98d951
removed unused imports
plutasnyy Sep 7, 2018
cb45bb3
update documentation in test executor
plutasnyy Sep 7, 2018
e954ac7
add documentation about Suite processing
plutasnyy Sep 8, 2018
4dc414d
fixed typos in documentation
plutasnyy Sep 8, 2018
d089a07
Merge remote-tracking branch 'origin/master' into feature/rerun
malaskowski Sep 10, 2018
acf4437
Merge remote-tracking branch 'origin/feature/rerun' into feature/reru…
plutasnyy Sep 10, 2018
6335fb5
add tests for run index wrapper
plutasnyy Sep 10, 2018
3112cd4
add tests for clean url from execution data
plutasnyy Sep 10, 2018
abcaed8
remove unused import
plutasnyy Sep 10, 2018
90ffdf5
add tests for processor strategy
plutasnyy Sep 10, 2018
c9c141d
craeted tests for suite test and url exection processor strategy
plutasnyy Sep 10, 2018
aaf3ab3
removed class
plutasnyy Sep 10, 2018
8d9fcd5
fixed wrong version incrementation
plutasnyy Sep 10, 2018
9f4c22a
Merge remote-tracking branch 'origin/master' into feature/rerun-chang…
plutasnyy Sep 10, 2018
4909046
Merge remote-tracking branch 'origin/master' into feature/rerun
plutasnyy Sep 10, 2018
bc500dc
Merge branch 'feature/rerun-change-way-to-execute-suite' into feature…
plutasnyy Sep 10, 2018
8c1d52a
changed way to update information about url rerun
plutasnyy Sep 11, 2018
648f823
removed usage of not existing function
plutasnyy Sep 11, 2018
0fee1db
start work with frontend
plutasnyy Sep 11, 2018
624da29
fix formatting in RunType
plutasnyy Sep 11, 2018
aeeefc5
changed returned type form test and url to optionals of test and url
plutasnyy Sep 11, 2018
4b66674
renmaed run decorator
plutasnyy Sep 11, 2018
39bb767
add uid
plutasnyy Sep 11, 2018
99959f1
changed usage of strategy in suite executor service
plutasnyy Sep 11, 2018
b72a58b
moved processor strategy mock to test directory
plutasnyy Sep 12, 2018
39c1554
fixed bug: rerun doesnt work because get() function was missing
plutasnyy Sep 12, 2018
fcbb7c2
fixed front end message about rerun
plutasnyy Sep 12, 2018
be44014
add very important brackets
plutasnyy Sep 12, 2018
188ed1a
changed logger name to lowercase
plutasnyy Sep 12, 2018
eac01e3
changed types in wrappers
plutasnyy Sep 12, 2018
4abab31
added h5 to information about rerun
plutasnyy Sep 12, 2018
ab35260
added condition for rerun infiromation on url page
plutasnyy Sep 12, 2018
b47ba4b
changed way to increment suite version
plutasnyy Sep 12, 2018
d915dd3
removed test from information about rerun:
plutasnyy Sep 12, 2018
c98ea26
added karaf endpoint
plutasnyy Sep 12, 2018
02c8c98
fixed typo
plutasnyy Sep 12, 2018
4a9fbf6
changed setting new suite version
plutasnyy Sep 12, 2018
caf218e
fixed / error
plutasnyy Sep 12, 2018
36420f8
fixed typos
plutasnyy Sep 12, 2018
49383c0
renamed wrappers package
plutasnyy Sep 12, 2018
9688e00
removed unused code
plutasnyy Sep 13, 2018
91ed8c4
changed uids in suite test url
plutasnyy Sep 13, 2018
98c81e2
added filters
plutasnyy Sep 13, 2018
f93d800
changed rerun's servlet endpoint
plutasnyy Sep 13, 2018
9028638
rerun button shows on only newest version of suite
plutasnyy Sep 13, 2018
e44f548
chenged uid
plutasnyy Sep 13, 2018
b07fa67
changed formating
plutasnyy Sep 13, 2018
dc50bd5
removed unnecesary casting
plutasnyy Sep 13, 2018
6c648e5
changed couting urls in test run index wrapper
plutasnyy Sep 13, 2018
4d27c1b
removed blank lines
plutasnyy Sep 13, 2018
6b81bba
Merge remote-tracking branch 'origin/master' into feature/rerun
plutasnyy Sep 13, 2018
08bce92
changed formating
plutasnyy Sep 13, 2018
6b8667a
changed urls
plutasnyy Sep 14, 2018
c8451cf
fixed NPE in get filters
plutasnyy Sep 14, 2018
0c2cd28
added uid for full progress log
plutasnyy Sep 17, 2018
9bc6cde
added <T> for metadata run decorator
plutasnyy Sep 17, 2018
9af85c2
fixed formatting
plutasnyy Sep 17, 2018
5f60048
Merge branch 'milestone/rerun-one-test' into feature/rerun
plutasnyy Sep 17, 2018
74dba89
increase maxparams in eslint
plutasnyy Sep 19, 2018
3e10020
Merge remote-tracking branch 'origin/master' into feature/rerun-chang…
plutasnyy Sep 26, 2018
c97b06c
changed newArray to emptyList in getFilters function in comparator class
plutasnyy Sep 26, 2018
3a2f6ec
added uid to progress log
plutasnyy Sep 26, 2018
5e1c2c3
added parameter to RunIndexWrapper
plutasnyy Sep 26, 2018
dbc5a0d
fixed url in test executor documentation
plutasnyy Sep 26, 2018
4403542
moved static function to helper from basid data servlet
plutasnyy Sep 26, 2018
ad910a5
updated metadatao uid and way to calculate quantity urls in suite run…
plutasnyy Sep 26, 2018
69e6edd
add parameter to metadata run decorator
plutasnyy Sep 26, 2018
5621f56
resolve generic types for runindexwrapper
malaskowski Sep 26, 2018
7eefd43
fixed rerun url path
plutasnyy Sep 26, 2018
cfb375f
fixed type of meta data run in tests
plutasnyy Sep 26, 2018
9b63cd6
added import to artifact srevlet after moved functions to other class
plutasnyy Sep 26, 2018
fa6784d
removed consol logs
plutasnyy Sep 26, 2018
bdbf8eb
minor refactor types, added validation if test exist
plutasnyy Oct 1, 2018
37c8079
added information about rerun after page refresh
plutasnyy Oct 1, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add serialVersionUID to this and all Serializable classes.


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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add serialVersionUID to this and all Serializable classes.


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();
}
Copy link
Contributor Author

@plutasnyy plutasnyy Sep 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be a little bit confusing why I compare filters with null, filters have initial value new ArrayList<> so they never are null, but if the array is empty, in the database we haven't got information about it, this field doesn't exist. It was the easiest way to solve NullPointerException, what do you think about saving filters:[] in the database when the array is empty? Or maybe you know another way to solve it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is managed by Suite.GSON_FOR_JSON Gson instance. It is used in toJson method. It has registered several adapters, one of them is to manage java Collection conversions. You may see the logic of dealing with null collections here:
https://github.com/Cognifide/aet/blob/master/api/communication-api/src/main/java/com/cognifide/aet/communication/api/metadata/gson/CollectionSerializer.java#L30

Let's just be sure that changing logic here won't break metadata documents saved before this change is introduced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can leave it as is, without refactoring GSON_FOR_JSON logic. But it should return Collections.emptyList() instead of new ArrayList<>().

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<>();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why urls is no longer final?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of this function

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

It was created for unit tests

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is for unit tests only, maybe it would be sufficient to make this setter package-protected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can not make it package-protected because it is not for the test this class but for the class that used Test class


/**
* @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