-
Notifications
You must be signed in to change notification settings - Fork 24
server: Add bookmarks endpoint support #102
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
Merged
bhufmann
merged 4 commits into
eclipse-tracecompass-incubator:master
from
kavehshahedi:bookmarks-endpoint
Nov 26, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a4e77bf
server: Add bookmarks endpoint support
kavehshahedi 7bc9b76
server: Add unit tests for BookmarkManagerService
kavehshahedi 0e3bab1
server: Use standard IMarker structure for storing bookmarks
kavehshahedi 1c09447
server: Update the trace server version to 0.3.0
kavehshahedi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
459 changes: 459 additions & 0 deletions
459
...ss/incubator/trace/server/jersey/rest/core/tests/services/BookmarkManagerServiceTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
156 changes: 156 additions & 0 deletions
156
...e/tracecompass/incubator/trace/server/jersey/rest/core/tests/stubs/BookmarkModelStub.java
This file contains hidden or 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,156 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2024 Ericsson | ||
| * | ||
| * All rights reserved. This program and the accompanying materials are | ||
| * made available under the terms of the Eclipse Public License 2.0 which | ||
| * accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| *******************************************************************************/ | ||
|
|
||
| package org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests.stubs; | ||
|
|
||
| import java.io.Serializable; | ||
| import java.util.Objects; | ||
| import java.util.UUID; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * A Stub class for the bookmark model. It matches the trace server protocol's | ||
| * <code>BookmarkModel</code> schema | ||
| * | ||
| * @author Kaveh Shahedi | ||
| */ | ||
| @JsonIgnoreProperties(ignoreUnknown = true) | ||
| public class BookmarkModelStub implements Serializable { | ||
| private static final long serialVersionUID = -1945923534635091200L; | ||
|
|
||
| private final UUID fUUID; | ||
| private final String fName; | ||
| private final long fStart; | ||
| private final long fEnd; | ||
|
|
||
| /** | ||
| * {@link JsonCreator} Constructor for final fields | ||
| * | ||
| * @param uuid | ||
| * The bookmark's UUID | ||
| * @param name | ||
| * The bookmark name | ||
| * @param start | ||
| * The start time | ||
| * @param end | ||
| * The end time | ||
| */ | ||
| @JsonCreator | ||
| public BookmarkModelStub( | ||
| @JsonProperty("uuid") UUID uuid, | ||
| @JsonProperty("name") String name, | ||
| @JsonProperty("start") long start, | ||
| @JsonProperty("end") long end) { | ||
| fUUID = Objects.requireNonNull(uuid, "The 'UUID' json field was not set"); | ||
| fName = Objects.requireNonNull(name, "The 'name' json field was not set"); | ||
| fStart = start; | ||
| fEnd = end; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor for comparing equality | ||
| * | ||
| * @param name | ||
| * bookmark name | ||
| * @param start | ||
| * start time | ||
| * @param end | ||
| * end time | ||
| */ | ||
| public BookmarkModelStub(String name, long start, long end) { | ||
| this(UUID.randomUUID(), name, start, end); | ||
| } | ||
|
|
||
| /** | ||
| * Get the UUID | ||
| * | ||
| * @return The UUID | ||
| */ | ||
| public UUID getUUID() { | ||
| return fUUID; | ||
| } | ||
|
|
||
| /** | ||
| * Get the bookmark name | ||
| * | ||
| * @return The bookmark name | ||
| */ | ||
| public String getName() { | ||
| return fName; | ||
| } | ||
|
|
||
| /** | ||
| * Get the start time | ||
| * | ||
| * @return The start time | ||
| */ | ||
| public long getStart() { | ||
| return fStart; | ||
| } | ||
|
|
||
| /** | ||
| * Get the end time | ||
| * | ||
| * @return The end time | ||
| */ | ||
| public long getEnd() { | ||
| return fEnd; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null) { | ||
| return false; | ||
| } | ||
| if (getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| BookmarkModelStub other = (BookmarkModelStub) obj; | ||
| if (fEnd != other.fEnd) { | ||
| return false; | ||
| } | ||
| if (fName == null) { | ||
| if (other.fName != null) { | ||
| return false; | ||
| } | ||
| } else if (!fName.equals(other.fName)) { | ||
| return false; | ||
| } | ||
| if (fStart != other.fStart) { | ||
| return false; | ||
| } | ||
| if (fUUID == null) { | ||
| if (other.fUUID != null) { | ||
| return false; | ||
| } | ||
| } else if (!fUUID.equals(other.fUUID)) { | ||
| return false; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "BookmarkModelStub [fUUID=" + fUUID + ", fName=" + fName + ", fStart=" + fStart + ", fEnd=" + fEnd + "]"; | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return super.hashCode(); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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
55 changes: 55 additions & 0 deletions
55
...eclipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/model/Bookmark.java
This file contains hidden or 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,55 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2024 Ericsson | ||
| * | ||
| * All rights reserved. This program and the accompanying materials are | ||
| * made available under the terms of the Eclipse Public License 2.0 which | ||
| * accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| *******************************************************************************/ | ||
|
|
||
| package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model; | ||
|
|
||
| import java.util.UUID; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNull; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** | ||
| * Contributes to the model used for TSP swagger-core annotations. | ||
| * | ||
| * @author Kaveh Shahedi | ||
| */ | ||
| public interface Bookmark { | ||
|
|
||
| /** | ||
| * @return The bookmark UUID. | ||
| */ | ||
| @JsonProperty("uuid") | ||
| @Schema(description = "The bookmark's unique identifier") | ||
| UUID getUUID(); | ||
|
|
||
| /** | ||
| * @return The bookmark name. | ||
| */ | ||
| @NonNull | ||
| @Schema(description = "User defined name for the bookmark") | ||
| String getName(); | ||
|
|
||
| /** | ||
| * @return The start time. | ||
| */ | ||
| @Schema(description = "The bookmark's start time") | ||
| long getStart(); | ||
|
|
||
| /** | ||
| * @return The end time. | ||
| */ | ||
| @Schema(description = "The bookmark's end time") | ||
| long getEnd(); | ||
|
|
||
| } |
58 changes: 58 additions & 0 deletions
58
...mpass/incubator/internal/trace/server/jersey/rest/core/model/BookmarkQueryParameters.java
This file contains hidden or 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,58 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2024 Ericsson | ||
| * | ||
| * All rights reserved. This program and the accompanying materials are | ||
| * made available under the terms of the Eclipse Public License 2.0 which | ||
| * accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| *******************************************************************************/ | ||
| package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.model; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import io.swagger.v3.oas.annotations.media.Schema.RequiredMode; | ||
|
|
||
| /** | ||
| * Parameters for bookmark creation and update operations | ||
| * | ||
| * @author Kaveh Shahedi | ||
| */ | ||
| public interface BookmarkQueryParameters { | ||
kavehshahedi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * @return The bookmark parameters | ||
| */ | ||
| @JsonProperty("parameters") | ||
| @Schema(description = "The bookmark parameters", requiredMode = RequiredMode.REQUIRED) | ||
| BookmarkParameters getParameters(); | ||
|
|
||
|
|
||
| /** | ||
| * Bookmark parameters | ||
| */ | ||
| interface BookmarkParameters { | ||
| /** | ||
| * @return The bookmark name | ||
| */ | ||
| @JsonProperty("name") | ||
| @Schema(description = "The name to give this bookmark", requiredMode = RequiredMode.REQUIRED) | ||
| String getName(); | ||
|
|
||
| /** | ||
| * @return The start time | ||
| */ | ||
| @JsonProperty("start") | ||
| @Schema(description = "The bookmark's start time", requiredMode = RequiredMode.REQUIRED) | ||
| long getStart(); | ||
|
|
||
| /** | ||
| * @return The end time | ||
| */ | ||
| @JsonProperty("end") | ||
| @Schema(description = "The bookmark's end time", requiredMode = RequiredMode.REQUIRED) | ||
| long getEnd(); | ||
| } | ||
| } | ||
97 changes: 97 additions & 0 deletions
97
...ipse/tracecompass/incubator/internal/trace/server/jersey/rest/core/services/Bookmark.java
This file contains hidden or 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,97 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2024 Ericsson | ||
| * | ||
| * All rights reserved. This program and the accompanying materials are | ||
| * made available under the terms of the Eclipse Public License 2.0 which | ||
| * accompanies this distribution, and is available at | ||
| * https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| *******************************************************************************/ | ||
| package org.eclipse.tracecompass.incubator.internal.trace.server.jersey.rest.core.services; | ||
kavehshahedi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| import java.io.Serializable; | ||
| import java.util.UUID; | ||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
|
||
| /** | ||
| * Bookmark model for TSP | ||
| * | ||
| * @author Kaveh Shahedi | ||
| */ | ||
| public class Bookmark implements Serializable { | ||
|
|
||
| private static final long serialVersionUID = 6126770413230064175L; | ||
|
|
||
| private final UUID fUUID; | ||
| private final String fName; | ||
| private final long fStart; | ||
| private final long fEnd; | ||
|
|
||
kavehshahedi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /** | ||
| * {@link JsonCreator} Constructor for final fields | ||
| * | ||
| * @param uuid | ||
| * the stub's UUID | ||
| * @param name | ||
| * bookmark name | ||
| * @param start | ||
| * start time | ||
| * @param end | ||
| * end time | ||
| */ | ||
| @JsonCreator | ||
| public Bookmark( | ||
| @JsonProperty("uuid") UUID uuid, | ||
| @JsonProperty("name") String name, | ||
| @JsonProperty("start") long start, | ||
| @JsonProperty("end") long end) { | ||
| fUUID = uuid; | ||
| fName = name; | ||
| fStart = start; | ||
| fEnd = end; | ||
| } | ||
|
|
||
| /** | ||
| * Get the UUID | ||
| * | ||
| * @return the UUID | ||
| */ | ||
| public UUID getUUID() { | ||
| return fUUID; | ||
| } | ||
|
|
||
| /** | ||
| * Get the bookmark name | ||
| * | ||
| * @return the bookmark name | ||
| */ | ||
| public String getName() { | ||
| return fName; | ||
| } | ||
|
|
||
| /** | ||
| * Get the start time | ||
| * | ||
| * @return the start time | ||
| */ | ||
| public long getStart() { | ||
| return fStart; | ||
| } | ||
|
|
||
| /** | ||
| * Get the end time | ||
| * | ||
| * @return the end time | ||
| */ | ||
| public long getEnd() { | ||
| return fEnd; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "Bookmark [fUUID=" + fUUID + ", fName=" + fName //$NON-NLS-1$ //$NON-NLS-2$ | ||
| + ", fStart=" + fStart + ", fEnd=" + fEnd + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.