Skip to content
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

Add apicurio latest version test #914

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,36 @@ public void shouldResolveArtifactViaArtifactIdVersion() throws Exception
assertEquals(expected, artifact);
}

@Test
@Specification({
"${local}/resolve.artifact.latest.version" })
public void shouldResolveArtifactLatestVersion() throws Exception
{
String expected = "asyncapi: 3.0.0\n" +
"info:\n" +
" title: Zilla MQTT Proxy\n" +
" version: 1.0.0\n" +
" license:\n" +
" name: Aklivity Community License\n" +
"servers:\n" +
" plain:\n" +
" host: mqtt://localhost:7183\n" +
" protocol: mqtt\n" +
"defaultContentType: application/json";

ApicurioCatalogHandler catalog = new ApicurioCatalogHandler(config, context, 0L);

int globalId = catalog.resolve("artifactId", "latest");

String artifact = catalog.resolve(globalId);

k3po.finish();

assertEquals(globalId, 1);
assertThat(artifact, not(nullValue()));
assertEquals(expected, artifact);
}

@Test
@Specification({
"${local}/resolve.artifact.via.global.id" })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright 2021-2023 Aklivity Inc
#
# Licensed under the Aklivity Community License (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy of the
# License at
#
# https://www.aklivity.io/aklivity-community-license/
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#

accept "http://localhost:8080/apis/registry/v2/groups/groupId/artifacts/artifactId/meta"

accepted
connected

read http:method "GET"
read http:version "HTTP/1.1"
read closed

write http:status "200" "OK"
write http:header "content-type" "application/json"
write http:content-length

write '{'
'\"contentId\": 1,'
'\"createdBy\": \"user1\",'
'\"createdOn\": \"2019-05-17T12:00:00Z\",'
'\"description\": \"The description of the artifact\",'
'\"globalId\": 1,'
'\"groupId\": \"groupId\",'
'\"id\": \"artifactId\",'
'\"type\":\"ASYNCAPI\",'
'\"version\": 0'
'}'

write close

accept "http://localhost:8080/apis/registry/v2/ids/globalIds/1"

accepted
connected

read http:method "GET"
read http:version "HTTP/1.1"
read closed

write http:status "200" "OK"
write http:header "content-type" "application/json"
write http:content-length

write 'asyncapi: 3.0.0\n'
'info:\n'
' title: Zilla MQTT Proxy\n'
' version: 1.0.0\n'
' license:\n'
' name: Aklivity Community License\n'
'servers:\n'
' plain:\n'
' host: mqtt://localhost:7183\n'
' protocol: mqtt\n'
'defaultContentType: application/json';

write close