11 | .----------. ____________ 12 | / .-. .-. \ / \ 13 | / | | | | \ | Aaaaaaah! | 14 | \ `-' `-' _/ / ___________/ 15 | /\ .--. / | /_/ 16 | \ | / / / / 17 | / | `--' /\ \ 18 | / / `-------' \ \ Jym Dyer 19 |20 |
When changing this, also update the sections marked with the comment "Current commit hash
10 | * available to jars" in backend/pom.xml and runner/pom.xml.
11 | */
12 | public class GitProperties {
13 |
14 | private static final Properties PROPERTIES;
15 |
16 | static {
17 | PROPERTIES = new Properties();
18 | try {
19 | PROPERTIES.load(GitProperties.class.getResourceAsStream("/git.properties"));
20 | } catch (IOException e) {
21 | throw new RuntimeException("Could not initialize git properties", e);
22 | }
23 | }
24 |
25 | public static String getBuildTime() {
26 | return PROPERTIES.getProperty("git.build.time");
27 | }
28 |
29 | public static String getVersion() {
30 | return PROPERTIES.getProperty("git.build.version");
31 | }
32 |
33 | public static String getHash() {
34 | return PROPERTIES.getProperty("git.commit.id.full");
35 | }
36 |
37 | public static String getHashAbbrev() {
38 | return PROPERTIES.getProperty("git.commit.id.abbrev");
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/frontend/src/util/GraphVariantSelection.ts:
--------------------------------------------------------------------------------
1 | import Vue from "vue";
2 | import EchartsDetailGraph from "@/components/graphs/graph/EchartsDetailGraph.vue";
3 | import DytailGraph from "@/components/graphs/graph/DytailGraph.vue";
4 |
5 | export type GraphVariant = {
6 | component: typeof Vue;
7 | name: string;
8 | };
9 |
10 | type GraphVariantPredicate = GraphVariant & {
11 | predicate: (visiblePoints: number) => boolean;
12 | };
13 |
14 | export const availableGraphComponents: GraphVariantPredicate[] = [
15 | {
16 | predicate: (visiblePoints: number): boolean => {
17 | // Do not care about zooming, only use echarts when he have only a handful of data points
18 | return visiblePoints < 30_000;
19 | },
20 | component: EchartsDetailGraph,
21 | name: "Fancy",
22 | },
23 | {
24 | predicate: (): boolean => {
25 | // matches from first to last. this one is the fallback
26 | return true;
27 | },
28 | component: DytailGraph,
29 | name: "Fast",
30 | },
31 | ];
32 |
33 | /**
34 | * Selets a fitting graph variant.
35 | *
36 | * @param visiblePoints the amount of visible points
37 | */
38 | export function selectGraphVariant(visiblePoints: number): GraphVariant | undefined {
39 | return availableGraphComponents.find((it) => it.predicate(visiblePoints));
40 | }
41 |
--------------------------------------------------------------------------------
/backend/backend/src/main/java/de/aaaaaaah/velcom/backend/access/repoaccess/exceptions/FailedToAddRepoException.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.backend.access.repoaccess.exceptions;
2 |
3 | import de.aaaaaaah.velcom.backend.access.repoaccess.entities.RemoteUrl;
4 | import de.aaaaaaah.velcom.shared.util.StringHelper;
5 |
6 | // TODO: 04.10.20 Update the db schema to make repo names unique and update javadoc
7 | // Add this text to the javadoc below once the db schema has been updated:
8 | // This is most likely due to another repo with the same name already existing.
9 |
10 | /** This exception is thrown when a repo could not be added into the db. */
11 | public class FailedToAddRepoException extends RuntimeException {
12 |
13 | private final String name;
14 | private final RemoteUrl remoteUrl;
15 |
16 | public FailedToAddRepoException(Throwable t, String name, RemoteUrl remoteUrl) {
17 | super(
18 | "failed to add repo named "
19 | + StringHelper.quote(name)
20 | + " for remote url "
21 | + StringHelper.quote(remoteUrl.getUrl()),
22 | t);
23 |
24 | this.name = name;
25 | this.remoteUrl = remoteUrl;
26 | }
27 |
28 | public String getName() {
29 | return name;
30 | }
31 |
32 | public RemoteUrl getRemoteUrl() {
33 | return remoteUrl;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/backend/backend/src/main/java/de/aaaaaaah/velcom/backend/storage/repo/exception/AddRepositoryException.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.backend.storage.repo.exception;
2 |
3 | import java.util.Objects;
4 |
5 | /** An exception that occurs when trying to add a repository to a repo storage fails. */
6 | public class AddRepositoryException extends Exception {
7 |
8 | private final String dirName;
9 | private final String remoteUrl;
10 |
11 | /**
12 | * Constructs a new {@link AddRepositoryException}.
13 | *
14 | * @param dirName the directory name for the repository
15 | * @param remoteUrl the remote url of the repository
16 | * @param cause the cause
17 | */
18 | public AddRepositoryException(String dirName, String remoteUrl, Throwable cause) {
19 | super("failed to add repository to directory \"" + dirName + "\": " + remoteUrl, cause);
20 | this.dirName = Objects.requireNonNull(dirName);
21 | this.remoteUrl = Objects.requireNonNull(remoteUrl);
22 | }
23 |
24 | /**
25 | * @return Returns the directory that should have been the directory for the repository
26 | */
27 | public String getDirName() {
28 | return dirName;
29 | }
30 |
31 | /**
32 | * @return Returns the remote url of the repository
33 | */
34 | public String getRemoteUrl() {
35 | return remoteUrl;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/backend/backend/src/main/java/de/aaaaaaah/velcom/backend/restapi/endpoints/DimensionsEndpoint.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.backend.restapi.endpoints;
2 |
3 | import de.aaaaaaah.velcom.backend.access.dimensionaccess.DimensionWriteAccess;
4 | import de.aaaaaaah.velcom.backend.restapi.authentication.Admin;
5 | import de.aaaaaaah.velcom.backend.restapi.jsonobjects.JsonDimensionId;
6 | import io.dropwizard.auth.Auth;
7 | import io.micrometer.core.annotation.Timed;
8 | import java.util.List;
9 | import java.util.stream.Collectors;
10 | import javax.validation.constraints.NotNull;
11 | import javax.ws.rs.DELETE;
12 | import javax.ws.rs.Path;
13 | import javax.ws.rs.Produces;
14 | import javax.ws.rs.core.MediaType;
15 |
16 | /** Endpoint for deleting dimensions. */
17 | @Path("/dimensions/")
18 | @Produces(MediaType.APPLICATION_JSON)
19 | public class DimensionsEndpoint {
20 |
21 | private final DimensionWriteAccess dimensionAccess;
22 |
23 | public DimensionsEndpoint(DimensionWriteAccess dimensionAccess) {
24 | this.dimensionAccess = dimensionAccess;
25 | }
26 |
27 | @DELETE
28 | @Timed(histogram = true)
29 | public void delete(@Auth Admin admin, @NotNull List This pair has a consistent {@link #equals(Object)} and {@link #hashCode()} method, if the two
9 | * element types have one.
10 | *
11 | * @param the type of the first element in the pair
12 | * @param the type of the second element in the pair
13 | */
14 | public class Pair {
15 |
16 | private final A first;
17 | private final B second;
18 |
19 | public Pair(A first, B second) {
20 | this.first = first;
21 | this.second = second;
22 | }
23 |
24 | public A getFirst() {
25 | return first;
26 | }
27 |
28 | public B getSecond() {
29 | return second;
30 | }
31 |
32 | @Override
33 | public boolean equals(Object o) {
34 | if (this == o) {
35 | return true;
36 | }
37 | if (o == null || getClass() != o.getClass()) {
38 | return false;
39 | }
40 | Pair, ?> pair = (Pair, ?>) o;
41 | return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);
42 | }
43 |
44 | @Override
45 | public int hashCode() {
46 | return Objects.hash(first, second);
47 | }
48 |
49 | @Override
50 | public String toString() {
51 | return "Pair{" + "first=" + first + ", second=" + second + '}';
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/backend/shared/src/test/java/de/aaaaaaah/velcom/shared/util/ExceptionHelperTest.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.shared.util;
2 |
3 | import static org.assertj.core.api.Assertions.assertThat;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | class ExceptionHelperTest {
8 |
9 | @Test
10 | void containsThisClass() {
11 | String stackTrace = ExceptionHelper.getStackTrace(new Throwable());
12 | assertThat(stackTrace).contains("ExceptionHelperTest").contains("containsThisClass");
13 | }
14 |
15 | @Test
16 | void containsNestedStacktrace() {
17 | RuntimeException inner = new RuntimeException("hello there");
18 | RuntimeException outer = new RuntimeException(inner);
19 |
20 | String stackTrace = ExceptionHelper.getStackTrace(outer);
21 | assertThat(stackTrace)
22 | .contains("ExceptionHelperTest")
23 | .contains("containsNestedStacktrace")
24 | .contains("hello there");
25 | }
26 |
27 | @Test
28 | void containsSuppressedStacktrace() {
29 | RuntimeException inner = new RuntimeException("hello there");
30 | RuntimeException outer = new RuntimeException();
31 | outer.addSuppressed(inner);
32 |
33 | String stackTrace = ExceptionHelper.getStackTrace(outer);
34 | assertThat(stackTrace)
35 | .contains("ExceptionHelperTest")
36 | .contains("containsSuppressedStacktrace")
37 | .contains("hello there");
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/backend/backend/src/main/java/de/aaaaaaah/velcom/backend/data/significance/SignificanceFactors.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.backend.data.significance;
2 |
3 | /**
4 | * A few factors describing how the standard deviation and significance of a run should be
5 | * determined.
6 | */
7 | public class SignificanceFactors {
8 |
9 | private final double relativeThreshold;
10 | private final double stddevThreshold;
11 | private final int minStddevAmount;
12 |
13 | public SignificanceFactors(
14 | double relativeThreshold, double stddevThreshold, int minStddevAmount) {
15 |
16 | if (relativeThreshold < 0) {
17 | throw new IllegalArgumentException("relative threshold must be >= 0");
18 | }
19 | if (stddevThreshold < 0) {
20 | throw new IllegalArgumentException("stddev threshold must be >= 0");
21 | }
22 | if (minStddevAmount < 2) {
23 | throw new IllegalArgumentException("minimum stddev amount must be at least 2");
24 | }
25 |
26 | this.relativeThreshold = relativeThreshold;
27 | this.stddevThreshold = stddevThreshold;
28 | this.minStddevAmount = minStddevAmount;
29 | }
30 |
31 | public double getRelativeThreshold() {
32 | return relativeThreshold;
33 | }
34 |
35 | public double getStddevThreshold() {
36 | return stddevThreshold;
37 | }
38 |
39 | public int getMinStddevAmount() {
40 | return minStddevAmount;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/backend/shared/src/main/java/de/aaaaaaah/velcom/shared/protocol/serialization/clientbound/ClientBoundPacket.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.shared.protocol.serialization.clientbound;
2 |
3 | import com.fasterxml.jackson.annotation.JsonCreator;
4 | import com.fasterxml.jackson.annotation.JsonProperty;
5 | import com.fasterxml.jackson.databind.JsonNode;
6 | import java.util.Objects;
7 |
8 | /** A packet that can be sent to the runner by the backend. */
9 | public class ClientBoundPacket {
10 |
11 | private final ClientBoundPacketType type;
12 | private final JsonNode data;
13 |
14 | @JsonCreator
15 | public ClientBoundPacket(
16 | @JsonProperty(required = true) ClientBoundPacketType type,
17 | @JsonProperty(required = true) JsonNode data) {
18 | this.type = type;
19 | this.data = data;
20 | }
21 |
22 | public ClientBoundPacketType getType() {
23 | return type;
24 | }
25 |
26 | public JsonNode getData() {
27 | return data;
28 | }
29 |
30 | @Override
31 | public boolean equals(Object o) {
32 | if (this == o) {
33 | return true;
34 | }
35 | if (o == null || getClass() != o.getClass()) {
36 | return false;
37 | }
38 | ClientBoundPacket that = (ClientBoundPacket) o;
39 | return type == that.type && data.equals(that.data);
40 | }
41 |
42 | @Override
43 | public int hashCode() {
44 | return Objects.hash(type, data);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/backend/backend/src/test/java/de/aaaaaaah/velcom/backend/access/dimensionaccess/entities/DimensionTest.java:
--------------------------------------------------------------------------------
1 | package de.aaaaaaah.velcom.backend.access.dimensionaccess.entities;
2 |
3 | import static org.assertj.core.api.Assertions.assertThat;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | class DimensionTest {
8 |
9 | @SuppressWarnings("EqualsWithItself")
10 | @Test
11 | void compareDimensions() {
12 | Dimension dimAA = new Dimension("a", "a");
13 | Dimension dimAB = new Dimension("a", "b");
14 | Dimension dimBA = new Dimension("b", "a");
15 | Dimension dimBB = new Dimension("b", "b");
16 |
17 | assertThat(dimAA.compareTo(dimAA)).isEqualTo(0);
18 | assertThat(dimAA).isLessThan(dimAB);
19 | assertThat(dimAA).isLessThan(dimBA);
20 | assertThat(dimAA).isLessThan(dimBB);
21 |
22 | assertThat(dimAB).isGreaterThan(dimAA);
23 | assertThat(dimAB.compareTo(dimAB)).isEqualTo(0);
24 | assertThat(dimAB).isLessThan(dimBA);
25 | assertThat(dimAB).isLessThan(dimBB);
26 |
27 | assertThat(dimBA).isGreaterThan(dimAA);
28 | assertThat(dimBA).isGreaterThan(dimAB);
29 | assertThat(dimBA.compareTo(dimBA)).isEqualTo(0);
30 | assertThat(dimBA).isLessThan(dimBB);
31 |
32 | assertThat(dimBB).isGreaterThan(dimAA);
33 | assertThat(dimBB).isGreaterThan(dimAB);
34 | assertThat(dimBB).isGreaterThan(dimBA);
35 | assertThat(dimBB.compareTo(dimBB)).isEqualTo(0);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
Please setup a runner and point it to this instance.
19 |