-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
server: Serialize TmfConfigurationSourceType schema as UTF8 string
See eclipse-cdt-cloud/trace-server-protocol#103 Also, add test for TmfConfigurationSourceType with schema as string. [Added] Serialize TmfConfigurationSourceType schema as string Signed-off-by: Bernd Hufmann <[email protected]>
- Loading branch information
Showing
8 changed files
with
204 additions
and
17 deletions.
There are no files selected for viewing
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
11 changes: 11 additions & 0 deletions
11
...-server/org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests/plugin.xml
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,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
<extension | ||
point="org.eclipse.tracecompass.tmf.core.config"> | ||
<source | ||
class="org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests.stubs.config.TestSchemaConfigurationSource" | ||
id="org.eclipse.tracecompass.tmf.core.config.xmlsourcetype"> | ||
</source> | ||
</extension> | ||
</plugin> |
30 changes: 30 additions & 0 deletions
30
...mpass.incubator.trace.server.jersey.rest.core.tests/schema/custom-execution-analysis.json
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,30 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"$id": "https://org.eclipse.tracecompass/custom-execution-analysis.json", | ||
"title": "Custom Execution Analysis", | ||
"description": "Custom Execution Analysis schema", | ||
"type": "object", | ||
"properties": { | ||
"cpus": { | ||
"description": "array of integer", | ||
"type": "array", | ||
"items": { | ||
"type": "number" | ||
} | ||
}, | ||
"thread": { | ||
"description": "Thread regular expression pattern", | ||
"type": "string" | ||
}, | ||
"phone": { | ||
"description": "Phone number", | ||
"type": "string", | ||
"pattern": "^(\\([0-9]{3}\\))?[0-9]{3}-[0-9]{4}$" | ||
}, | ||
"label": { | ||
"description": "Optional label text", | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["thread"] | ||
} |
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
108 changes: 108 additions & 0 deletions
108
...bator/trace/server/jersey/rest/core/tests/stubs/config/TestSchemaConfigurationSource.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,108 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 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.config; | ||
|
||
import static org.eclipse.tracecompass.common.core.NonNullUtils.nullToEmptyString; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.eclipse.core.runtime.FileLocator; | ||
import org.eclipse.core.runtime.IPath; | ||
import org.eclipse.core.runtime.Platform; | ||
import org.eclipse.jdt.annotation.NonNull; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.tracecompass.tmf.core.config.ITmfConfiguration; | ||
import org.eclipse.tracecompass.tmf.core.config.ITmfConfigurationSource; | ||
import org.eclipse.tracecompass.tmf.core.config.ITmfConfigurationSourceType; | ||
import org.eclipse.tracecompass.tmf.core.config.TmfConfigurationSourceType; | ||
import org.eclipse.tracecompass.tmf.core.exceptions.TmfConfigurationException; | ||
import org.osgi.framework.Bundle; | ||
|
||
/** | ||
* Test class | ||
*/ | ||
public class TestSchemaConfigurationSource implements ITmfConfigurationSource { | ||
|
||
private static final @NonNull ITmfConfigurationSourceType fType; | ||
|
||
private static final @NonNull String TEST_ANALYSIS_TYPE_ID = "org.eclipse.tracecompass.tmf.core.config.testschemasourcetype"; //$NON-NLS-1$ | ||
private static final @NonNull String NAME = nullToEmptyString("Test Schema Type"); //$NON-NLS-1$ | ||
private static final @NonNull String DESCRIPTION = nullToEmptyString("Test Type with schema"); //$NON-NLS-1$ | ||
|
||
static { | ||
Bundle bundle = Platform.getBundle("org.eclipse.tracecompass.incubator.trace.server.jersey.rest.core.tests"); | ||
IPath defaultPath = new org.eclipse.core.runtime.Path("schema/custom-execution-analysis.json"); //$NON-NLS-1$ | ||
URL url = FileLocator.find(bundle, defaultPath, null); | ||
File schemaFile = null; | ||
try { | ||
schemaFile = new File(FileLocator.toFileURL(url).toURI()); | ||
} catch (URISyntaxException | IOException e) { | ||
e.printStackTrace(); | ||
} | ||
fType = new TmfConfigurationSourceType.Builder() | ||
.setId(TEST_ANALYSIS_TYPE_ID) | ||
.setDescription(DESCRIPTION) | ||
.setName(NAME) | ||
.setSchemaFile(schemaFile) | ||
.setConfigParamDescriptors(Collections.emptyList()).build(); | ||
} | ||
|
||
/** | ||
* Constructor | ||
*/ | ||
public TestSchemaConfigurationSource() { | ||
} | ||
|
||
@Override | ||
public @NonNull ITmfConfigurationSourceType getConfigurationSourceType() { | ||
return fType; | ||
} | ||
|
||
@Override | ||
public @NonNull ITmfConfiguration create(@NonNull Map<@NonNull String, @NonNull Object> parameters) throws TmfConfigurationException { | ||
throw new TmfConfigurationException("Not implemented yet"); //$NON-NLS-1$ | ||
} | ||
|
||
@Override | ||
public @NonNull ITmfConfiguration update(@NonNull String id, @NonNull Map<@NonNull String, @NonNull Object> parameters) throws TmfConfigurationException { | ||
throw new TmfConfigurationException("Not implemented yet"); //$NON-NLS-1$ | ||
} | ||
|
||
@Override | ||
public @Nullable ITmfConfiguration get(@NonNull String id) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public @Nullable ITmfConfiguration remove(@NonNull String id) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public boolean contains(@NonNull String id) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public @NonNull List<@NonNull ITmfConfiguration> getConfigurations() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public void dispose() { | ||
} | ||
} |
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