org.conqat.engine.sourcecode.coverage.TestDetails Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of teamscale-commons Show documentation
Show all versions of teamscale-commons Show documentation
Provides common DTOs for Teamscale
/*
* Copyright (c) CQSE GmbH
*
* 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 org.conqat.engine.sourcecode.coverage;
import java.io.Serializable;
import java.util.LinkedHashMap;
import javax.annotation.Nullable;
import org.conqat.engine.commons.findings.location.TextRegionLocation;
import org.conqat.lib.commons.js_export.ExportToTypeScript;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Represents a test case data class, holding an uniformPath (Teamscale
* internal).
*/
@ExportToTypeScript
public class TestDetails implements Serializable {
private static final long serialVersionUID = 1L;
/** The name of the JSON property name for {@link #content}. */
protected static final String CONTENT_PROPERTY = "content";
/** The name of the JSON property name for {@link #lastChangedTimestamp}. */
protected static final String LAST_CHANGED_TIMESTAMP_PROPERTY = "lastChangedTimestamp";
/**
* Some kind of content to tell whether the test specification has changed. Can
* be revision number or hash over the specification or similar.
*/
@JsonProperty(CONTENT_PROPERTY)
@Nullable
protected String content;
/** The last timestamp at which the content of the test did change. */
@JsonProperty(LAST_CHANGED_TIMESTAMP_PROPERTY)
protected long lastChangedTimestamp;
/** The test location */
@JsonProperty("location")
@Nullable
protected TextRegionLocation location;
/** The test location */
@JsonProperty("locationWithComment")
@Nullable
protected TextRegionLocation locationWithComment;
/** The hash of the test implementation */
@JsonProperty("implementationHash")
@Nullable
protected String implementationHash;
/**
* Holds all custom properties of that test case. We use a LinkedHashMap here as
* the order of the properties should be deterministic as it is shown in the UI
* in that order.
*/
@JsonProperty("properties")
private final LinkedHashMap properties = new LinkedHashMap<>();
public TestDetails(String content) {
this(content, 0L);
}
@JsonCreator
public TestDetails(@Nullable @JsonProperty(CONTENT_PROPERTY) String content,
@JsonProperty(LAST_CHANGED_TIMESTAMP_PROPERTY) long lastChangedTimestamp) {
this.content = content;
this.lastChangedTimestamp = lastChangedTimestamp;
}
public TestDetails(String implementationHash, long lastChangedTimestamp, TextRegionLocation location,
TextRegionLocation locationWithComment) {
this(null, lastChangedTimestamp);
this.location = location;
this.locationWithComment = locationWithComment;
this.implementationHash = implementationHash;
}
/** @see #location */
@Nullable
public TextRegionLocation getLocation() {
return location;
}
/** @see #location */
public void setLocation(@Nullable TextRegionLocation location) {
this.location = location;
}
/** @see #locationWithComment */
@Nullable
public TextRegionLocation getLocationWithComment() {
return locationWithComment;
}
/** @see #locationWithComment */
public void setLocationWithComment(@Nullable TextRegionLocation locationWithComment) {
this.locationWithComment = locationWithComment;
}
/** @see #content */
@Nullable
public String getContent() {
return content;
}
/** @see #content */
public void setContent(@Nullable String content) {
this.content = content;
}
/** @see #lastChangedTimestamp */
public long getLastChangedTimestamp() {
return lastChangedTimestamp;
}
/** @see #lastChangedTimestamp */
public void setLastChangedTimestamp(long lastChangedTimestamp) {
this.lastChangedTimestamp = lastChangedTimestamp;
}
/** @see #implementationHash */
@Nullable
public String getImplementationHash() {
return implementationHash;
}
/** @see #implementationHash */
public void setImplementationHash(@Nullable String implementationHash) {
this.implementationHash = implementationHash;
}
/** @see #properties */
public LinkedHashMap getProperties() {
return properties;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy