mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-13 22:15:26 +00:00
bug 5409: Interim commit: Introducing tags field to Selenium test
version of FreestyleProperties
This commit is contained in:
1 parent
8886994985
commit
387f83a51d
4 files changed
+19
-13
No files matched your search
+1
-1
@@ -70,7 +70,7 @@ public class CourseConfiguration extends JsonWrapper {
|
||||
public MarkConfiguration getMarkConfigurationByEffectiveName(String name) {
|
||||
MarkConfiguration result = null;
|
||||
for (MarkConfiguration markConfiguration : getMarkConfigurations()) {
|
||||
MarkAppearance effectiveProperties = markConfiguration.getEffectiveProperties();
|
||||
FreestyleProperties effectiveProperties = markConfiguration.getEffectiveProperties();
|
||||
if (effectiveProperties != null && name.equals(effectiveProperties.getName())) {
|
||||
result = markConfiguration;
|
||||
break;
|
||||
|
||||
+8
-4
@@ -1,10 +1,12 @@
|
||||
package com.sap.sailing.selenium.api.coursetemplate;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.json.simple.JSONObject;
|
||||
|
||||
import com.sap.sailing.selenium.api.core.JsonWrapper;
|
||||
|
||||
public class MarkAppearance extends JsonWrapper {
|
||||
public class FreestyleProperties extends JsonWrapper {
|
||||
|
||||
private static final String FIELD_NAME = "name";
|
||||
private static final String FIELD_SHORT_NAME = "shortName";
|
||||
@@ -12,13 +14,14 @@ public class MarkAppearance extends JsonWrapper {
|
||||
private static final String FIELD_SHAPE = "shape";
|
||||
private static final String FIELD_PATTERN = "pattern";
|
||||
private static final String FIELD_MARK_TYPE = "markType";
|
||||
private static final String FIELD_TAG = "tag";
|
||||
|
||||
public MarkAppearance(final JSONObject json) {
|
||||
public FreestyleProperties(final JSONObject json) {
|
||||
super(json);
|
||||
}
|
||||
|
||||
public MarkAppearance(final String name, final String shortName, final String color, final String shape,
|
||||
final String pattern, final String markType) {
|
||||
public FreestyleProperties(final String name, final String shortName, final String color, final String shape,
|
||||
final String pattern, final String markType, Set<String> tags) {
|
||||
super(new JSONObject());
|
||||
getJson().put(FIELD_NAME, name);
|
||||
getJson().put(FIELD_SHORT_NAME, shortName);
|
||||
@@ -26,6 +29,7 @@ public class MarkAppearance extends JsonWrapper {
|
||||
getJson().put(FIELD_SHAPE, shape);
|
||||
getJson().put(FIELD_PATTERN, pattern);
|
||||
getJson().put(FIELD_MARK_TYPE, markType);
|
||||
getJson().put(FIELD_TAG, tags);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
+7
-6
@@ -4,6 +4,7 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class MarkConfiguration extends JsonWrapper {
|
||||
|
||||
public static MarkConfiguration createFreestyle(final UUID markTemplateId, final UUID markPropertiesId,
|
||||
final UUID associatedRoleId, final String name, final String shortName, final String color,
|
||||
final String shape, final String pattern, final String markType) {
|
||||
final String shape, final String pattern, final String markType, Set<String> tags) {
|
||||
MarkConfiguration markConfiguration = new MarkConfiguration(new JSONObject());
|
||||
markConfiguration.getJson().put(FIELD_ID, UUID.randomUUID().toString());
|
||||
if (markTemplateId != null) {
|
||||
@@ -51,7 +52,7 @@ public class MarkConfiguration extends JsonWrapper {
|
||||
markConfiguration.getJson().put(FIELD_ASSOCIATED_ROLE_ID, associatedRoleId.toString());
|
||||
}
|
||||
markConfiguration.getJson().put(FIELD_FREESTYLE_PROPERTIES,
|
||||
new MarkAppearance(name, shortName, color, shape, pattern, markType).getJson());
|
||||
new FreestyleProperties(name, shortName, color, shape, pattern, markType, tags).getJson());
|
||||
return markConfiguration;
|
||||
}
|
||||
|
||||
@@ -137,14 +138,14 @@ public class MarkConfiguration extends JsonWrapper {
|
||||
return markTemplateId != null ? UUID.fromString((String) markTemplateId) : null;
|
||||
}
|
||||
|
||||
public MarkAppearance getEffectiveProperties() {
|
||||
public FreestyleProperties getEffectiveProperties() {
|
||||
final JSONObject effectivePropertiesJson = (JSONObject) get(FIELD_EFFECTIVE_PROPERTIES);
|
||||
return effectivePropertiesJson != null ? new MarkAppearance(effectivePropertiesJson) : null;
|
||||
return effectivePropertiesJson != null ? new FreestyleProperties(effectivePropertiesJson) : null;
|
||||
}
|
||||
|
||||
public MarkAppearance getFreestyleProperties() {
|
||||
public FreestyleProperties getFreestyleProperties() {
|
||||
final JSONObject effectivePropertiesJson = (JSONObject) get(FIELD_FREESTYLE_PROPERTIES);
|
||||
return effectivePropertiesJson != null ? new MarkAppearance(effectivePropertiesJson) : null;
|
||||
return effectivePropertiesJson != null ? new FreestyleProperties(effectivePropertiesJson) : null;
|
||||
}
|
||||
|
||||
public boolean isStoreToInventory() {
|
||||
|
||||
+3
-2
@@ -12,6 +12,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -153,11 +154,11 @@ public class MarkApiTest extends AbstractSeleniumTest {
|
||||
|
||||
final String pinEndName = "Start/Finish Pin";
|
||||
final MarkConfiguration sfp = MarkConfiguration.createFreestyle(null, null, null, pinEndName, "SFP", null, null,
|
||||
null, MarkType.BUOY.name());
|
||||
null, MarkType.BUOY.name(), Collections.emptySet());
|
||||
sfp.setFixedPosition(47.159776, 27.5891346);
|
||||
sfp.setStoreToInventory(true);
|
||||
final MarkConfiguration sfb = MarkConfiguration.createFreestyle(null, null, null, "Start/Finish Boat", "SFB",
|
||||
null, null, null, MarkType.STARTBOAT.name());
|
||||
null, null, null, MarkType.STARTBOAT.name(), Collections.emptySet());
|
||||
sfp.setStoreToInventory(true);
|
||||
final MarkConfiguration sft = MarkConfiguration.createMarkBased(mark.getMarkId(), null);
|
||||
sft.setFixedPosition(47.159776, 37.5891346);
|
||||
|
||||
Reference in new issue
Block a user