Skip to content

Commit

Permalink
build: fix tests (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndr-brt authored Dec 19, 2024
1 parent 09efe65 commit 9fd8788
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import org.eclipse.edc.catalog.spi.QueryService;
import org.eclipse.edc.jsonld.spi.JsonLd;
import org.eclipse.edc.runtime.metamodel.annotation.Configuration;
import org.eclipse.edc.runtime.metamodel.annotation.Extension;
import org.eclipse.edc.runtime.metamodel.annotation.Inject;
import org.eclipse.edc.runtime.metamodel.annotation.Setting;
import org.eclipse.edc.runtime.metamodel.annotation.Settings;
import org.eclipse.edc.spi.EdcException;
import org.eclipse.edc.spi.system.ServiceExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
Expand All @@ -31,6 +34,8 @@
import org.eclipse.edc.web.jersey.providers.jsonld.JerseyJsonLdInterceptor;
import org.eclipse.edc.web.jersey.providers.jsonld.ObjectMapperProvider;
import org.eclipse.edc.web.spi.WebService;
import org.eclipse.edc.web.spi.configuration.PortMapping;
import org.eclipse.edc.web.spi.configuration.PortMappingRegistry;

import java.io.IOException;
import java.util.stream.Stream;
Expand All @@ -53,28 +58,28 @@
public class FederatedCatalogApiExtension implements ServiceExtension {

public static final String NAME = "Cache Query API Extension";
public static final String CATALOG_QUERY_SCOPE = "CATALOG_QUERY_API";

static final String CATALOG_QUERY_SCOPE = "CATALOG_QUERY_API";
private static final String API_VERSION_JSON_FILE = "catalog-version.json";

@Configuration
private CatalogApiConfiguration apiConfiguration;

@Inject
private WebService webService;

@Inject
private QueryService queryService;

@Inject(required = false)
private HealthCheckService healthCheckService;
@Inject
private JsonLd jsonLd;
@Inject
private TypeManager typeManager;

@Inject
private TypeTransformerRegistry transformerRegistry;

@Inject
private ApiVersionService apiVersionService;
@Inject
private PortMappingRegistry portMappingRegistry;

@Override
public String name() {
Expand All @@ -83,6 +88,7 @@ public String name() {

@Override
public void initialize(ServiceExtensionContext context) {
portMappingRegistry.register(new PortMapping(CATALOG_QUERY, apiConfiguration.port(), apiConfiguration.path()));

jsonLd.registerNamespace(VOCAB, EDC_NAMESPACE, CATALOG_QUERY_SCOPE);
jsonLd.registerNamespace(EDC_PREFIX, EDC_NAMESPACE, CATALOG_QUERY_SCOPE);
Expand Down Expand Up @@ -119,4 +125,14 @@ private void registerVersionInfo(ClassLoader resourceClassLoader) {
throw new EdcException(e);
}
}

@Settings
record CatalogApiConfiguration(
@Setting(key = "web.http." + CATALOG_QUERY + ".port", description = "Port for " + CATALOG_QUERY + " api context", defaultValue = 17171 + "")
int port,
@Setting(key = "web.http." + CATALOG_QUERY + ".path", description = "Path for " + CATALOG_QUERY + " api context", defaultValue = "/api/catalog")
String path
) {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@

@ComponentTest
public class CatalogRuntimeComponentTest {

public static final String TEST_CATALOG_ID = "test-catalog-id";
private static final Duration TEST_TIMEOUT = ofSeconds(10);
private static final ObjectMapper OBJECT_MAPPER = createObjectMapper();
private static final JsonLd JSON_LD_SERVICE = new TitaniumJsonLd(mock());

@RegisterExtension
protected static RuntimeExtension runtimePerClassExtension = new RuntimePerMethodExtension(new EmbeddedRuntime("catalog", Map.of(
// make sure only one crawl-run is performed
Expand Down

0 comments on commit 9fd8788

Please sign in to comment.