-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[vividus-to-zephyr-exporter] Add ability import tests to zephyr
- Loading branch information
1 parent
476c13b
commit 1eb61f8
Showing
49 changed files
with
1,702 additions
and
281 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
project.description = 'Vividus common exporter' | ||
|
||
configurations.testImplementation { | ||
exclude group: 'org.apache.logging.log4j', module: 'log4j-slf4j18-impl' | ||
exclude group: 'ch.qos.logback', module: 'logback-classic' | ||
} | ||
|
||
dependencies { | ||
implementation project(':vividus-facade-jira') | ||
|
||
implementation(group: 'org.slf4j', name: 'slf4j-api', version: versions.slf4j) | ||
implementation platform(group: 'org.apache.logging.log4j', name: 'log4j-bom', version: '2.17.0') | ||
implementation(group: 'org.apache.logging.log4j', name: 'log4j-api') | ||
implementation(group: 'org.apache.logging.log4j', name: 'log4j-core') | ||
implementation(group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl') | ||
implementation(group: 'org.hamcrest', name: 'hamcrest', version: versions.hamcrest) | ||
|
||
testImplementation platform(group: 'org.junit', name: 'junit-bom', version: versions.junit) | ||
testImplementation(group: 'org.junit.jupiter', name: 'junit-jupiter') | ||
testImplementation(group: 'org.mockito', name: 'mockito-junit-jupiter', version: versions.mockito) | ||
testImplementation(group: 'com.github.valfirst', name: 'slf4j-test', version: versions.slf4jTest) | ||
} |
100 changes: 100 additions & 0 deletions
100
vividus-engine/src/main/java/org/vividus/model/jbehave/IContainingMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* | ||
* Copyright 2019-2022 the original author or authors. | ||
* | ||
* 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 | ||
* | ||
* https://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 org.vividus.model.jbehave; | ||
|
||
import static org.vividus.model.MetaWrapper.META_VALUES_SEPARATOR; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedHashSet; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
public interface IContainingMeta | ||
{ | ||
List<Meta> getMeta(); | ||
|
||
/** | ||
* Get unique <b>meta</b> value | ||
* | ||
* <p>If the <b>meta</b> does not exist or has no value, an empty {@link Optional} will be returned | ||
* | ||
* <p><i>Notes</i> | ||
* <ul> | ||
* <li><b>meta</b> value is trimmed upon returning</li> | ||
* <li><i>;</i> char is used as a separator for <b>meta</b> with multiple values</li> | ||
* </ul> | ||
* | ||
* @param metaName the meta name | ||
* @return the meta value | ||
* @throws NotUniqueMetaValueException if the <b>meta</b> has more than one value | ||
*/ | ||
default Optional<String> getUniqueMetaValue(String metaName) throws NotUniqueMetaValueException | ||
{ | ||
Set<String> values = getMetaValues(metaName); | ||
if (values.size() > 1) | ||
{ | ||
throw new NotUniqueMetaValueException(metaName, values); | ||
} | ||
return values.isEmpty() ? Optional.empty() : Optional.of(values.iterator().next()); | ||
} | ||
|
||
/** | ||
* Get all <b>meta</b> values | ||
* | ||
* <p><i>Notes</i> | ||
* <ul> | ||
* <li><b>meta</b>s without value are ignored</li> | ||
* <li><b>meta</b> values are trimmed upon returning</li> | ||
* <li><i>;</i> char is used as a separator for <b>meta</b> with multiple values</li> | ||
* </ul> | ||
* | ||
* @param metaName the meta name | ||
* @return the meta values | ||
*/ | ||
default Set<String> getMetaValues(String metaName) | ||
{ | ||
return getMetaStream().filter(m -> metaName.equals(m.getName())) | ||
.map(Meta::getValue) | ||
.filter(StringUtils::isNotEmpty) | ||
.map(String::trim) | ||
.map(value -> StringUtils.splitPreserveAllTokens(value, META_VALUES_SEPARATOR)) | ||
.flatMap(Stream::of) | ||
.map(String::trim) | ||
.collect(Collectors.toCollection(LinkedHashSet::new)); | ||
} | ||
|
||
/** | ||
* Determine if scenario has <b>meta</b> with the name | ||
* | ||
* @param metaName the meta name | ||
* @return {@code true} if scenario has meta with the name | ||
*/ | ||
default boolean hasMetaWithName(String metaName) | ||
{ | ||
return getMetaStream().anyMatch(m -> metaName.equals(m.getName())); | ||
} | ||
|
||
private Stream<Meta> getMetaStream() | ||
{ | ||
return Optional.ofNullable(getMeta()).stream().flatMap(Collection::stream); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.