Search in sources :

Example 11 with Search

use of nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search in project ORCID-Source by ORCID.

the class PublicV2ApiServiceVersionedDelegatorTest method testSearchByQuery.

@Test
public void testSearchByQuery() {
    MockitoAnnotations.initMocks(this);
    Search search = new Search();
    Result result = new Result();
    result.setOrcidIdentifier(new OrcidIdentifier("some-orcid-id"));
    search.getResults().add(result);
    Response searchResponse = Response.ok(search).build();
    Mockito.when(mockServiceDelegatorNonVersioned.searchByQuery(Matchers.<Map<String, List<String>>>any())).thenReturn(searchResponse);
    TargetProxyHelper.injectIntoProxy(serviceDelegator, "publicV2ApiServiceDelegator", mockServiceDelegatorNonVersioned);
    Response response = serviceDelegator.searchByQuery(new HashMap<String, List<String>>());
    // just testing MemberV2ApiServiceDelegatorImpl's response is returned
    assertNotNull(response);
    assertNotNull(response.getEntity());
    assertTrue(response.getEntity() instanceof Search);
    assertEquals(1, ((Search) response.getEntity()).getResults().size());
    assertEquals("some-orcid-id", ((Search) response.getEntity()).getResults().get(0).getOrcidIdentifier().getPath());
    TargetProxyHelper.injectIntoProxy(serviceDelegator, "publicV2ApiServiceDelegator", serviceDelegatorNonVersioned);
}
Also used : Response(javax.ws.rs.core.Response) OrcidIdentifier(org.orcid.jaxb.model.common_v2.OrcidIdentifier) Search(org.orcid.jaxb.model.search_v2.Search) List(java.util.List) ArrayList(java.util.ArrayList) Result(org.orcid.jaxb.model.search_v2.Result) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 12 with Search

use of nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search in project aem-core-wcm-components by Adobe-Marketing-Cloud.

the class SearchIT method setupBeforeEach.

/**
 * Before Test Case
 */
@BeforeEach
public void setupBeforeEach() throws ClientException {
    // level 1
    page1Path = authorClient.createPage("page_1", "page_1", rootPage, defaultPageTemplate).getSlingPath();
    HashMap<String, String> data = new HashMap<String, String>();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Parent Page 1");
    Commons.editNodeProperties(adminClient, page1Path, data);
    // create 20 pages
    for (int i = 0; i < 20; i++) {
        String pagePath = authorClient.createPage("page" + i, "page" + i, page1Path, defaultPageTemplate).getSlingPath();
        data.clear();
        data.put("_charset_", "UTF-8");
        data.put("./jcr:content/jcr:title", "Page " + i);
        Commons.editNodeProperties(adminClient, pagePath, data);
    }
    // level 2
    page11Path = authorClient.createPage("page_1_1", "page_1_1", page1Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1");
    Commons.editNodeProperties(adminClient, page11Path, data);
    // level 2 1
    page111Path = authorClient.createPage("page_1_1_1", "page_1_1_1", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.1");
    Commons.editNodeProperties(adminClient, page111Path, data);
    // level 2 2
    page112Path = authorClient.createPage("page_1_1_2", "page_1_1_2", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.2");
    Commons.editNodeProperties(adminClient, page112Path, data);
    // level 2 3
    String page113Path = authorClient.createPage("page_1_1_3", "page_1_1_3", page11Path, defaultPageTemplate).getSlingPath();
    data.clear();
    data.put("_charset_", "UTF-8");
    data.put("./jcr:content/jcr:title", "Page 1.1.3");
    Commons.editNodeProperties(adminClient, page113Path, data);
    // 2.
    String policySuffix = "/structure/page/new_policy";
    data.clear();
    data.put("jcr:title", "New Policy");
    data.put("sling:resourceType", "wcm/core/components/policy/policy");
    data.put("clientlibs", clientlibs);
    String policyPath1 = "/conf/" + label + "/settings/wcm/policies/core-component/components";
    policyPath = Commons.createPolicy(adminClient, policySuffix, data, policyPath1);
    // 3.
    String policyLocation = "core-component/components";
    String policyAssignmentPath = defaultPageTemplate + "/policies/jcr:content";
    data.clear();
    data.put("cq:policy", policyLocation + policySuffix);
    data.put("sling:resourceType", "wcm/core/components/policies/mappings");
    Commons.assignPolicy(adminClient, "", data, policyAssignmentPath);
    // create a proxy component
    proxyPath = Commons.createProxyComponent(adminClient, Commons.rtSearch_v1, Commons.proxyPath, null, null);
    // add the component to test page
    compPath = Commons.addComponent(adminClient, proxyPath, page11Path + Commons.relParentCompPath, "search", null);
    // open test page in page editor
    editorPage = new PageEditorPage(page11Path);
    editorPage.open();
    search = new Search();
}
Also used : HashMap(java.util.HashMap) Search(com.adobe.cq.wcm.core.components.it.seljup.util.components.search.v1.Search) PageEditorPage(com.adobe.cq.testing.selenium.pageobject.PageEditorPage) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 13 with Search

use of nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search in project timbuctoo by HuygensING.

the class JsonMetadata method getForCollection.

private JsonNode getForCollection(Collection collection, List<Vertex> relations, boolean withCollectionInfo) {
    ArrayNode result = jsnA();
    collection.getWriteableProperties().forEach((name, prop) -> {
        ObjectNode desc = jsnO("name", jsn(name), "type", jsn(prop.getTypeId()));
        prop.getOptions().ifPresent(options -> desc.set("options", jsnA(options.stream().map(JsonBuilder::jsn))));
        prop.getParts().ifPresent(parts -> desc.set("options", jsnA(parts.stream().map(JsonBuilder::jsn))));
        result.add(desc);
    });
    // FIXME add check to vres that certifies that the defined derived relations exist in the database
    String abstractType = collection.getAbstractType();
    Vre vre = collection.getVre();
    Map<String, String> keywordTypes = vre.getKeywordTypes();
    String relationCollectionName = vre.getImplementerOf("relation").map(Collection::getCollectionName).orElse(null);
    if (relationCollectionName == null) {
        LOG.warn(Logmarkers.databaseInvariant, "Collection {} seems to have no relationCollections", collection.getCollectionName());
    }
    relations.stream().filter(v -> getProp(v, "relationtype_sourceTypeName", String.class).orElse("").equals(abstractType)).forEach(v -> {
        String timId = getProp(v, "tim_id", String.class).orElse("<unknown>");
        Optional<String> regularName = getProp(v, "relationtype_regularName", String.class);
        Optional<String> inverseName = getProp(v, "relationtype_inverseName", String.class);
        Optional<String> abstractTargetType = getProp(v, "relationtype_targetTypeName", String.class);
        Optional<String> targetType = abstractTargetType.flatMap(typeName -> vre.getImplementerOf(typeName).map(Collection::getCollectionName));
        if (regularName.isPresent() && inverseName.isPresent() && targetType.isPresent()) {
            // special support for keywords:
            URI quickSearchUrl;
            if (abstractTargetType.orElse("").equals("keyword")) {
                quickSearchUrl = Autocomplete.makeUrl(targetType.get(), Optional.empty(), Optional.ofNullable(keywordTypes.get(regularName.get())));
            } else {
                quickSearchUrl = Autocomplete.makeUrl(targetType.get());
            }
            boolean isSymmetric = getProp(v, "relationtype_symmetric", Boolean.class).orElse(false);
            result.add(jsnO("name", jsn(regularName.get()), "type", jsn("relation"), "quicksearch", jsn(quickSearchUrl.toString()), "relation", jsnO(// for search
            "direction", isSymmetric ? jsn("BOTH") : jsn("OUT"), "outName", jsn(regularName.get()), "inName", jsn(inverseName.get()), "targetCollection", jsn(targetType.get()), // for CRUD
            "relationCollection", jsn(relationCollectionName), "relationTypeId", jsn(timId))));
        } else {
            if (!regularName.isPresent() || !inverseName.isPresent() || !abstractTargetType.isPresent()) {
                LOG.error(Logmarkers.databaseInvariant, "RelationType should have a relationtype_regularName, relationtype_inverseName and " + "relationtype_targetTypeName, but one of those is missing for " + v.id());
            }
        }
    });
    relations.stream().filter(v -> {
        final String targetType = getProp(v, "relationtype_targetTypeName", String.class).orElse("");
        final boolean isSymmetric = getProp(v, "relationtype_symmetric", Boolean.class).orElse(false);
        if (isSymmetric) {
            final String sourceType = getProp(v, "relationtype_sourceTypeName", String.class).orElse("");
            return targetType.equals(abstractType) && !sourceType.equals(targetType);
        } else {
            return targetType.equals(abstractType);
        }
    }).forEach(v -> {
        String timId = getProp(v, "tim_id", String.class).orElse("<unknown>");
        Optional<String> regularName = getProp(v, "relationtype_regularName", String.class);
        Optional<String> inverseName = getProp(v, "relationtype_inverseName", String.class);
        Optional<String> abstractTargetType = getProp(v, "relationtype_sourceTypeName", String.class);
        Optional<String> targetType = abstractTargetType.flatMap(typeName -> vre.getImplementerOf(typeName).map(Collection::getCollectionName));
        if (regularName.isPresent() && inverseName.isPresent() && targetType.isPresent()) {
            // special support for keywords:
            URI quickSearchUrl;
            if (abstractTargetType.orElse("").equals("keyword")) {
                quickSearchUrl = Autocomplete.makeUrl(targetType.get(), Optional.empty(), Optional.ofNullable(keywordTypes.get(regularName.get())));
            } else {
                quickSearchUrl = Autocomplete.makeUrl(targetType.get());
            }
            result.add(jsnO("name", jsn(inverseName.get()), "type", jsn("relation"), "quicksearch", jsn(quickSearchUrl.toString()), "relation", jsnO(// for search
            "direction", jsn("IN"), "outName", jsn(regularName.get()), "inName", jsn(inverseName.get()), "targetCollection", jsn(targetType.get()), // for CRUD
            "relationCollection", jsn(relationCollectionName), "relationTypeId", jsn(timId))));
        } else {
            if (!regularName.isPresent() || !inverseName.isPresent() || !abstractTargetType.isPresent()) {
                LOG.error(Logmarkers.databaseInvariant, "RelationType should have a relationtype_regularName, relationtype_inverseName and " + "relationtype_targetTypeName, but one of those is missing for " + v.id());
            }
        }
    });
    if (withCollectionInfo) {
        return jsnO("collectionName", jsn(collection.getCollectionName()), "collectionLabel", jsn(collection.getCollectionLabel()), "description", jsn(collection.getDescription()), "unknown", jsn(collection.isUnknown()), "relationCollection", jsn(collection.isRelationCollection()), "archetypeName", jsn(collection.getAbstractType()), "properties", result);
    } else {
        return result;
    }
}
Also used : JsonBuilder.jsnO(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnO) Logger(org.slf4j.Logger) Autocomplete(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Autocomplete) JsonBuilder(nl.knaw.huygens.timbuctoo.util.JsonBuilder) LabelP(org.apache.tinkerpop.gremlin.neo4j.process.traversal.LabelP) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) T(org.apache.tinkerpop.gremlin.structure.T) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Logmarkers(nl.knaw.huygens.timbuctoo.logging.Logmarkers) Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) List(java.util.List) GraphWrapper(nl.knaw.huygens.timbuctoo.server.GraphWrapper) Stream(java.util.stream.Stream) Map(java.util.Map) JsonBuilder.jsnA(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsnA) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) Optional(java.util.Optional) GraphReadUtils.getProp(nl.knaw.huygens.timbuctoo.model.GraphReadUtils.getProp) JsonNode(com.fasterxml.jackson.databind.JsonNode) URI(java.net.URI) JsonBuilder.jsn(nl.knaw.huygens.timbuctoo.util.JsonBuilder.jsn) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) URI(java.net.URI)

Example 14 with Search

use of nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search in project timbuctoo by HuygensING.

the class TimbuctooV4 method run.

@Override
public void run(TimbuctooConfiguration configuration, Environment environment) throws Exception {
    // environment.jersey().property(ServerProperties.TRACING, "ALL");
    // // environment.jersey().property(ServerProperties.TRACING_THRESHOLD, "VERBOSE");
    // Make sure we know what version is running
    Properties properties = new Properties();
    InputStream gitproperties = getClass().getClassLoader().getResourceAsStream("git.properties");
    String currentVersion;
    if (gitproperties != null) {
        properties.load(gitproperties);
        currentVersion = properties.getProperty("git.commit.id");
    } else {
        currentVersion = "NO-GIT-PROPERTIES-FOUND";
        LoggerFactory.getLogger(this.getClass()).error("NO-GIT-PROPERTIES-FOUND");
    }
    LoggerFactory.getLogger(this.getClass()).info("Now launching timbuctoo version: " + currentVersion);
    HttpClientBuilder apacheHttpClientBuilder = new HttpClientBuilder(environment).using(configuration.getHttpClientConfiguration());
    CloseableHttpClient httpClient = apacheHttpClientBuilder.build("httpclient");
    // Support services
    SecurityFactory securityConfig = configuration.getSecurityConfiguration().createNewSecurityFactory(httpClient);
    securityConfig.getHealthChecks().forEachRemaining(check -> {
        register(environment, check.getLeft(), new LambdaHealthCheck(check.getRight()));
    });
    // Database migration
    LinkedHashMap<String, DatabaseMigration> migrations = new LinkedHashMap<>();
    migrations.put("fix-dcarkeywords-displayname-migration", new FixDcarKeywordDisplayNameMigration());
    migrations.put("fix-pids-migration", new MakePidsAbsoluteUrls());
    UriHelper uriHelper = configuration.getUriHelper();
    environment.lifecycle().addServerLifecycleListener(new BaseUriDeriver(configuration));
    TinkerPopConfig tinkerPopConfig = configuration.getDatabaseConfiguration();
    final TinkerPopGraphManager graphManager = new TinkerPopGraphManager(tinkerPopConfig, migrations);
    final PersistenceManager persistenceManager = configuration.getPersistenceManagerFactory().build();
    UrlGenerator uriToRedirectToFromPersistentUrls = (coll, id, rev) -> uriHelper.fromResourceUri(SingleEntity.makeUrl(coll, id, rev));
    final UrlGenerator pathWithoutVersionAndRevision = (coll, id, rev) -> URI.create(SingleEntity.makeUrl(coll, id, null).toString().replaceFirst("^/v2.1/", ""));
    final UrlGenerator uriWithoutRev = (coll, id, rev) -> uriHelper.fromResourceUri(SingleEntity.makeUrl(coll, id, null));
    HandleAdder handleAdder = new HandleAdder(persistenceManager, activeMqBundle);
    // TODO make function when TimbuctooActions does not depend on TransactionEnforcer anymore
    TimbuctooActions.TimbuctooActionsFactory timbuctooActionsFactory = new TimbuctooActions.TimbuctooActionsFactoryImpl(securityConfig.getPermissionFetcher(), Clock.systemDefaultZone(), handleAdder, uriToRedirectToFromPersistentUrls, () -> new TinkerPopOperations(graphManager));
    TransactionEnforcer transactionEnforcer = new TransactionEnforcer(timbuctooActionsFactory);
    graphManager.onGraph(g -> new ScaffoldMigrator(graphManager).execute());
    handleAdder.init(transactionEnforcer);
    final Vres vres = new DatabaseConfiguredVres(transactionEnforcer);
    migrations.put("prepare-for-bia-import-migration", new PrepareForBiaImportMigration(vres, graphManager));
    migrations.put("give-existing-relationtypes-rdf-uris", new RelationTypeRdfUriMigration());
    migrations.put("remove-search-results", new RemoveSearchResultsMigration());
    migrations.put("move-indices-to-isLatest-vertex", new MoveIndicesToIsLatestVertexMigration(vres));
    final ResourceSyncService resourceSyncService = new ResourceSyncService(httpClient, new ResourceSyncContext());
    final JsonMetadata jsonMetadata = new JsonMetadata(vres, graphManager);
    final AutocompleteService.AutocompleteServiceFactory autocompleteServiceFactory = new AutocompleteService.AutocompleteServiceFactory(uriWithoutRev);
    environment.lifecycle().manage(graphManager);
    final CrudServiceFactory crudServiceFactory = new CrudServiceFactory(vres, securityConfig.getUserValidator(), pathWithoutVersionAndRevision);
    final Webhooks webhooks = configuration.getWebhooks().getWebHook(environment);
    DataSetRepository dataSetRepository = configuration.getDataSetConfiguration().createRepository(environment.lifecycle().executorService("dataSet").build(), securityConfig.getPermissionFetcher(), configuration.getDatabases(), configuration.getRdfIdHelper(), (combinedId -> {
        try {
            webhooks.dataSetUpdated(combinedId);
        } catch (IOException e) {
            LOG.error("Webhook call failed", e);
        }
    }), configuration.dataSetsArePublicByDefault());
    environment.lifecycle().manage(new DataSetRepositoryManager(dataSetRepository));
    ErrorResponseHelper errorResponseHelper = new ErrorResponseHelper();
    AuthCheck authCheck = new AuthCheck(securityConfig.getUserValidator(), securityConfig.getPermissionFetcher(), dataSetRepository);
    register(environment, new RdfUpload(authCheck));
    register(environment, new TabularUpload(authCheck, dataSetRepository, errorResponseHelper));
    register(environment, new Rml(dataSetRepository, errorResponseHelper, securityConfig.getUserValidator()));
    SerializerWriterRegistry serializerWriterRegistry = new SerializerWriterRegistry(new CsvWriter(), new JsonLdWriter(), new JsonWriter(), new GraphVizWriter());
    final PaginationArgumentsHelper argHelper = new PaginationArgumentsHelper(configuration.getCollectionFilters());
    final GraphQl graphQlEndpoint = new GraphQl(new RootQuery(dataSetRepository, serializerWriterRegistry, configuration.getArchetypesSchema(), new RdfWiringFactory(dataSetRepository, argHelper, configuration.getDefaultSummaryProps()), new DerivedSchemaTypeGenerator(argHelper), environment.getObjectMapper()), serializerWriterRegistry, securityConfig.getUserValidator(), uriHelper, securityConfig.getPermissionFetcher(), dataSetRepository);
    register(environment, graphQlEndpoint);
    if (securityConfig instanceof TwitterSecurityFactory) {
        final TwitterLogin twitterLogin = new TwitterLogin();
        register(environment, twitterLogin);
    }
    register(environment, new JsonLdEditEndpoint(securityConfig.getUserValidator(), securityConfig.getPermissionFetcher(), dataSetRepository, new HttpClientBuilder(environment).build("json-ld")));
    register(environment, new RootEndpoint(uriHelper, configuration.getUserRedirectUrl()));
    if (securityConfig instanceof OldStyleSecurityFactory) {
        register(environment, new Authenticate(((OldStyleSecurityFactory) securityConfig).getLoggedInUsers()));
    }
    register(environment, new Me(securityConfig.getUserValidator()));
    register(environment, new Search(configuration, uriHelper, graphManager));
    register(environment, new Autocomplete(autocompleteServiceFactory, transactionEnforcer));
    register(environment, new Index(securityConfig.getUserValidator(), crudServiceFactory, transactionEnforcer));
    register(environment, new SingleEntity(securityConfig.getUserValidator(), crudServiceFactory, transactionEnforcer));
    register(environment, new SingleEntityNTriple(transactionEnforcer, uriHelper));
    register(environment, new WomenWritersEntityGet(crudServiceFactory, transactionEnforcer));
    register(environment, new LegacySingleEntityRedirect(uriHelper));
    register(environment, new LegacyIndexRedirect(uriHelper));
    register(environment, new Discover(resourceSyncService));
    if (configuration.isAllowGremlinEndpoint()) {
        register(environment, new Gremlin(graphManager));
    }
    register(environment, new Graph(graphManager, vres));
    register(environment, new RelationTypes(graphManager));
    register(environment, new Metadata());
    register(environment, new nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.vres.Metadata(jsonMetadata));
    register(environment, new MyVres(securityConfig.getUserValidator(), securityConfig.getPermissionFetcher(), transactionEnforcer, uriHelper));
    register(environment, new ListVres(uriHelper, transactionEnforcer));
    register(environment, new VreImage(transactionEnforcer));
    final ExecutorService rfdExecutorService = environment.lifecycle().executorService("rdf-import").build();
    register(environment, new ImportRdf(graphManager, vres, rfdExecutorService, transactionEnforcer));
    register(environment, new Import(new ResourceSyncFileLoader(httpClient), authCheck));
    register(environment, new WellKnown());
    RsDocumentBuilder rsDocumentBuilder = new RsDocumentBuilder(dataSetRepository, configuration.getUriHelper());
    register(environment, new RsEndpoint(rsDocumentBuilder, securityConfig.getUserValidator()));
    // Admin resources
    if (securityConfig instanceof OldStyleSecurityFactory) {
        final OldStyleSecurityFactory oldStyleSecurityFactory = (OldStyleSecurityFactory) securityConfig;
        environment.admin().addTask(new UserCreationTask(new LocalUserCreator(oldStyleSecurityFactory.getLoginCreator(), oldStyleSecurityFactory.getUserCreator(), oldStyleSecurityFactory.getVreAuthorizationCreator())));
    }
    environment.admin().addTask(new DatabaseValidationTask(new DatabaseValidator(graphManager, new LabelsAddedToVertexDatabaseCheck(), new InvariantsCheck(vres), new FullTextIndexCheck()), Clock.systemUTC(), 5000));
    environment.admin().addTask(new DbLogCreatorTask(graphManager));
    environment.admin().addTask(new BdbDumpTask(configuration.getDatabases()));
    if (configuration.getDatabaseBackupper().isPresent()) {
        environment.admin().addTask(new StagingBackup(configuration.getDatabaseBackupper().get().create(configuration.getDatabaseConfiguration().getDatabasePath(), configuration.getDatabases().getDatabaseLocation())));
    }
    // register health checks
    // Dropwizard Health checks are used to check whether requests should be routed to this instance
    // For example, checking if neo4j is in a valid state is not a "HealthCheck" because if the database on one instance
    // is in an invalid state, then this applies to all other instances too. So once the database is in an invalid state
    // timbuctoo will be down.
    // 
    // checking whether this instance is part of the neo4j quorum is a good HealthCheck because running a database query
    // on those instances that are not part of the quorum will block forever, while the other instances will respond
    // just fine.
    register(environment, "Neo4j database connection", graphManager);
    // Log all http requests
    register(environment, new LoggingFilter(1024, currentVersion));
    register(environment, new TransactionFilter(graphManager));
    // Allow all CORS requests
    register(environment, new PromiscuousCorsFilter());
    // Add embedded AMQ (if any) to the metrics
    configuration.getLocalAmqJmxPath(HANDLE_QUEUE).ifPresent(rethrowConsumer(jmxPath -> {
        String dwMetricName = name(this.getClass(), "localAmq");
        ObjectName jmxMetricName = new ObjectName(jmxPath);
        environment.metrics().register(dwMetricName + ".enqueueCount", new JmxAttributeGauge(jmxMetricName, "EnqueueCount"));
        environment.metrics().register(dwMetricName + ".dequeueCount", new JmxAttributeGauge(jmxMetricName, "DequeueCount"));
    }));
    setupObjectMapping(environment);
}
Also used : TransactionEnforcer(nl.knaw.huygens.timbuctoo.core.TransactionEnforcer) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) WellKnown(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.WellKnown) ListVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.vres.ListVres) FixDcarKeywordDisplayNameMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.FixDcarKeywordDisplayNameMigration) DbLogCreatorTask(nl.knaw.huygens.timbuctoo.server.tasks.DbLogCreatorTask) RootEndpoint(nl.knaw.huygens.timbuctoo.server.endpoints.RootEndpoint) Index(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Index) DerivedSchemaTypeGenerator(nl.knaw.huygens.timbuctoo.v5.graphql.derivedschema.DerivedSchemaTypeGenerator) RootQuery(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.RootQuery) LambdaHealthCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.LambdaHealthCheck) DataSetRepositoryManager(nl.knaw.huygens.timbuctoo.v5.dropwizard.DataSetRepositoryManager) LegacyIndexRedirect(nl.knaw.huygens.timbuctoo.server.endpoints.legacy.LegacyIndexRedirect) TinkerPopConfig(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerPopConfig) JsonWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.JsonWriter) Server(org.eclipse.jetty.server.Server) TabularUpload(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.TabularUpload) Autocomplete(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Autocomplete) BdbDumpTask(nl.knaw.huygens.timbuctoo.server.tasks.BdbDumpTask) MoveIndicesToIsLatestVertexMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.MoveIndicesToIsLatestVertexMigration) UserCreationTask(nl.knaw.huygens.timbuctoo.server.tasks.UserCreationTask) DatabaseMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.DatabaseMigration) GraphQl(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.GraphQl) TwitterSecurityFactory(nl.knaw.huygens.timbuctoo.v5.security.twitterexample.TwitterSecurityFactory) LambdaExceptionUtil.rethrowConsumer(nl.knaw.huygens.timbuctoo.util.LambdaExceptionUtil.rethrowConsumer) WomenWritersEntityGet(nl.knaw.huygens.timbuctoo.experimental.womenwriters.WomenWritersEntityGet) FullTextIndexCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.FullTextIndexCheck) RdfWiringFactory(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.RdfWiringFactory) Bootstrap(io.dropwizard.setup.Bootstrap) LocalUserCreator(nl.knaw.huygens.timbuctoo.server.security.LocalUserCreator) LegacySingleEntityRedirect(nl.knaw.huygens.timbuctoo.server.endpoints.legacy.LegacySingleEntityRedirect) Gremlin(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Gremlin) UrlGenerator(nl.knaw.huygens.timbuctoo.crud.UrlGenerator) InvariantsCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.InvariantsCheck) LinkedHashMap(java.util.LinkedHashMap) VreImage(nl.knaw.huygens.timbuctoo.server.endpoints.v2.VreImage) ErrorResponseHelper(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.ErrorResponseHelper) JmxAttributeGauge(com.codahale.metrics.JmxAttributeGauge) SubstitutingSourceProvider(io.dropwizard.configuration.SubstitutingSourceProvider) HttpClientBuilder(io.dropwizard.client.HttpClientBuilder) PrepareForBiaImportMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.PrepareForBiaImportMigration) LoggingFilter(nl.knaw.huygens.timbuctoo.logging.LoggingFilter) ResourceSyncService(nl.knaw.huygens.timbuctoo.remote.rs.ResourceSyncService) AuthCheck(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.auth.AuthCheck) Environment(io.dropwizard.setup.Environment) Properties(java.util.Properties) TinkerPopOperations(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerPopOperations) Import(nl.knaw.huygens.timbuctoo.server.endpoints.v2.remote.rs.Import) ServerLifecycleListener(io.dropwizard.lifecycle.ServerLifecycleListener) IOException(java.io.IOException) MakePidsAbsoluteUrls(nl.knaw.huygens.timbuctoo.server.databasemigration.MakePidsAbsoluteUrls) TransactionFilter(nl.knaw.huygens.timbuctoo.database.tinkerpop.TransactionFilter) RdfUpload(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.RdfUpload) RelationTypes(nl.knaw.huygens.timbuctoo.server.endpoints.v2.RelationTypes) CrudServiceFactory(nl.knaw.huygens.timbuctoo.crud.CrudServiceFactory) Graph(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Graph) GraphVizWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.GraphVizWriter) JsonLdEditEndpoint(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.JsonLdEditEndpoint) RsEndpoint(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.RsEndpoint) PaginationArgumentsHelper(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.PaginationArgumentsHelper) Webhooks(nl.knaw.huygens.timbuctoo.solr.Webhooks) Me(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.users.Me) Metadata(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Metadata) LabelsAddedToVertexDatabaseCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.LabelsAddedToVertexDatabaseCheck) LoggerFactory(org.slf4j.LoggerFactory) SecurityFactory(nl.knaw.huygens.timbuctoo.v5.security.SecurityFactory) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) FacetValue(nl.knaw.huygens.timbuctoo.search.FacetValue) Rml(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.Rml) SingleEntityNTriple(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.SingleEntityNTriple) UriHelper(nl.knaw.huygens.timbuctoo.util.UriHelper) JsonLdWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.JsonLdWriter) ScaffoldMigrator(nl.knaw.huygens.timbuctoo.server.databasemigration.ScaffoldMigrator) HandleAdder(nl.knaw.huygens.timbuctoo.handle.HandleAdder) OldStyleSecurityFactory(nl.knaw.huygens.timbuctoo.security.OldStyleSecurityFactory) URI(java.net.URI) HANDLE_QUEUE(nl.knaw.huygens.timbuctoo.handle.HandleAdder.HANDLE_QUEUE) Application(io.dropwizard.Application) DatabaseValidator(nl.knaw.huygens.timbuctoo.server.healthchecks.DatabaseValidator) ResourceSyncFileLoader(nl.knaw.huygens.timbuctoo.remote.rs.download.ResourceSyncFileLoader) SerializerWriterRegistry(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.SerializerWriterRegistry) PersistenceManager(nl.knaw.huygens.persistence.PersistenceManager) JsonMetadata(nl.knaw.huygens.timbuctoo.model.properties.JsonMetadata) ObjectName(javax.management.ObjectName) ImportRdf(nl.knaw.huygens.timbuctoo.server.endpoints.v2.ImportRdf) ActiveMQBundle(com.kjetland.dropwizard.activemq.ActiveMQBundle) InetSocketAddress(java.net.InetSocketAddress) AssetsBundle(io.dropwizard.assets.AssetsBundle) TwitterLogin(nl.knaw.huygens.timbuctoo.v5.security.twitterexample.TwitterLogin) ResourceSyncContext(nl.knaw.huygens.timbuctoo.remote.rs.xml.ResourceSyncContext) DatabaseConfiguredVres(nl.knaw.huygens.timbuctoo.model.vre.vres.DatabaseConfiguredVres) AutocompleteService(nl.knaw.huygens.timbuctoo.search.AutocompleteService) Search(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search) EnvironmentVariableSubstitutor(io.dropwizard.configuration.EnvironmentVariableSubstitutor) TimbuctooActions(nl.knaw.huygens.timbuctoo.core.TimbuctooActions) RsDocumentBuilder(nl.knaw.huygens.timbuctoo.v5.datastores.rssource.RsDocumentBuilder) StagingBackup(nl.knaw.huygens.timbuctoo.v5.dropwizard.tasks.StagingBackup) ExecutorService(java.util.concurrent.ExecutorService) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) Logger(org.slf4j.Logger) Discover(nl.knaw.huygens.timbuctoo.server.endpoints.v2.remote.rs.Discover) CsvWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.CsvWriter) HealthCheck(com.codahale.metrics.health.HealthCheck) RemoveSearchResultsMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.RemoveSearchResultsMigration) RelationTypeRdfUriMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.RelationTypeRdfUriMigration) Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) ServerSocketChannel(java.nio.channels.ServerSocketChannel) MultiPartBundle(io.dropwizard.forms.MultiPartBundle) SingleEntity(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.SingleEntity) FacetValueDeserializer(nl.knaw.huygens.timbuctoo.server.mediatypes.v2.search.FacetValueDeserializer) MyVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.users.MyVres) Clock(java.time.Clock) Authenticate(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Authenticate) Connector(org.eclipse.jetty.server.Connector) MetricRegistry.name(com.codahale.metrics.MetricRegistry.name) DatabaseValidationTask(nl.knaw.huygens.timbuctoo.server.tasks.DatabaseValidationTask) InputStream(java.io.InputStream) Import(nl.knaw.huygens.timbuctoo.server.endpoints.v2.remote.rs.Import) GraphQl(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.GraphQl) RemoveSearchResultsMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.RemoveSearchResultsMigration) JsonMetadata(nl.knaw.huygens.timbuctoo.model.properties.JsonMetadata) MakePidsAbsoluteUrls(nl.knaw.huygens.timbuctoo.server.databasemigration.MakePidsAbsoluteUrls) LocalUserCreator(nl.knaw.huygens.timbuctoo.server.security.LocalUserCreator) UriHelper(nl.knaw.huygens.timbuctoo.util.UriHelper) TransactionEnforcer(nl.knaw.huygens.timbuctoo.core.TransactionEnforcer) PrepareForBiaImportMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.PrepareForBiaImportMigration) MoveIndicesToIsLatestVertexMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.MoveIndicesToIsLatestVertexMigration) UrlGenerator(nl.knaw.huygens.timbuctoo.crud.UrlGenerator) SingleEntityNTriple(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.SingleEntityNTriple) Discover(nl.knaw.huygens.timbuctoo.server.endpoints.v2.remote.rs.Discover) WellKnown(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.WellKnown) Graph(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Graph) JsonLdWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.JsonLdWriter) RootEndpoint(nl.knaw.huygens.timbuctoo.server.endpoints.RootEndpoint) OldStyleSecurityFactory(nl.knaw.huygens.timbuctoo.security.OldStyleSecurityFactory) FullTextIndexCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.FullTextIndexCheck) TinkerPopOperations(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerPopOperations) SingleEntity(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.SingleEntity) ResourceSyncContext(nl.knaw.huygens.timbuctoo.remote.rs.xml.ResourceSyncContext) Metadata(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Metadata) JsonMetadata(nl.knaw.huygens.timbuctoo.model.properties.JsonMetadata) HttpClientBuilder(io.dropwizard.client.HttpClientBuilder) RelationTypeRdfUriMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.RelationTypeRdfUriMigration) TwitterLogin(nl.knaw.huygens.timbuctoo.v5.security.twitterexample.TwitterLogin) DatabaseConfiguredVres(nl.knaw.huygens.timbuctoo.model.vre.vres.DatabaseConfiguredVres) ListVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.vres.ListVres) RsDocumentBuilder(nl.knaw.huygens.timbuctoo.v5.datastores.rssource.RsDocumentBuilder) DatabaseValidationTask(nl.knaw.huygens.timbuctoo.server.tasks.DatabaseValidationTask) InvariantsCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.InvariantsCheck) CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) MyVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.users.MyVres) HandleAdder(nl.knaw.huygens.timbuctoo.handle.HandleAdder) DerivedSchemaTypeGenerator(nl.knaw.huygens.timbuctoo.v5.graphql.derivedschema.DerivedSchemaTypeGenerator) IOException(java.io.IOException) ImportRdf(nl.knaw.huygens.timbuctoo.server.endpoints.v2.ImportRdf) DataSetRepositoryManager(nl.knaw.huygens.timbuctoo.v5.dropwizard.DataSetRepositoryManager) VreImage(nl.knaw.huygens.timbuctoo.server.endpoints.v2.VreImage) CrudServiceFactory(nl.knaw.huygens.timbuctoo.crud.CrudServiceFactory) RdfUpload(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.RdfUpload) Rml(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.Rml) StagingBackup(nl.knaw.huygens.timbuctoo.v5.dropwizard.tasks.StagingBackup) Webhooks(nl.knaw.huygens.timbuctoo.solr.Webhooks) TwitterSecurityFactory(nl.knaw.huygens.timbuctoo.v5.security.twitterexample.TwitterSecurityFactory) JsonLdEditEndpoint(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.JsonLdEditEndpoint) LegacyIndexRedirect(nl.knaw.huygens.timbuctoo.server.endpoints.legacy.LegacyIndexRedirect) TwitterSecurityFactory(nl.knaw.huygens.timbuctoo.v5.security.twitterexample.TwitterSecurityFactory) SecurityFactory(nl.knaw.huygens.timbuctoo.v5.security.SecurityFactory) OldStyleSecurityFactory(nl.knaw.huygens.timbuctoo.security.OldStyleSecurityFactory) JmxAttributeGauge(com.codahale.metrics.JmxAttributeGauge) DataSetRepository(nl.knaw.huygens.timbuctoo.v5.dataset.DataSetRepository) Index(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Index) LinkedHashMap(java.util.LinkedHashMap) Authenticate(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Authenticate) PaginationArgumentsHelper(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.PaginationArgumentsHelper) Search(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Search) Gremlin(nl.knaw.huygens.timbuctoo.server.endpoints.v2.Gremlin) TinkerPopConfig(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerPopConfig) RelationTypes(nl.knaw.huygens.timbuctoo.server.endpoints.v2.RelationTypes) TimbuctooActions(nl.knaw.huygens.timbuctoo.core.TimbuctooActions) ListVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.vres.ListVres) DatabaseConfiguredVres(nl.knaw.huygens.timbuctoo.model.vre.vres.DatabaseConfiguredVres) Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) MyVres(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.users.MyVres) UserCreationTask(nl.knaw.huygens.timbuctoo.server.tasks.UserCreationTask) DatabaseValidator(nl.knaw.huygens.timbuctoo.server.healthchecks.DatabaseValidator) PersistenceManager(nl.knaw.huygens.persistence.PersistenceManager) LabelsAddedToVertexDatabaseCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.databasechecks.LabelsAddedToVertexDatabaseCheck) FixDcarKeywordDisplayNameMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.FixDcarKeywordDisplayNameMigration) ErrorResponseHelper(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.ErrorResponseHelper) Me(nl.knaw.huygens.timbuctoo.server.endpoints.v2.system.users.Me) DbLogCreatorTask(nl.knaw.huygens.timbuctoo.server.tasks.DbLogCreatorTask) TransactionFilter(nl.knaw.huygens.timbuctoo.database.tinkerpop.TransactionFilter) LegacySingleEntityRedirect(nl.knaw.huygens.timbuctoo.server.endpoints.legacy.LegacySingleEntityRedirect) LoggingFilter(nl.knaw.huygens.timbuctoo.logging.LoggingFilter) BdbDumpTask(nl.knaw.huygens.timbuctoo.server.tasks.BdbDumpTask) Properties(java.util.Properties) LambdaHealthCheck(nl.knaw.huygens.timbuctoo.server.healthchecks.LambdaHealthCheck) Autocomplete(nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Autocomplete) AuthCheck(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.auth.AuthCheck) TabularUpload(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.TabularUpload) SerializerWriterRegistry(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.SerializerWriterRegistry) DatabaseMigration(nl.knaw.huygens.timbuctoo.server.databasemigration.DatabaseMigration) ResourceSyncService(nl.knaw.huygens.timbuctoo.remote.rs.ResourceSyncService) GraphVizWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.GraphVizWriter) CsvWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.CsvWriter) InputStream(java.io.InputStream) RootQuery(nl.knaw.huygens.timbuctoo.v5.graphql.rootquery.RootQuery) ResourceSyncFileLoader(nl.knaw.huygens.timbuctoo.remote.rs.download.ResourceSyncFileLoader) WomenWritersEntityGet(nl.knaw.huygens.timbuctoo.experimental.womenwriters.WomenWritersEntityGet) JsonWriter(nl.knaw.huygens.timbuctoo.v5.dropwizard.contenttypes.JsonWriter) ObjectName(javax.management.ObjectName) RsEndpoint(nl.knaw.huygens.timbuctoo.v5.dropwizard.endpoints.RsEndpoint) AutocompleteService(nl.knaw.huygens.timbuctoo.search.AutocompleteService) ScaffoldMigrator(nl.knaw.huygens.timbuctoo.server.databasemigration.ScaffoldMigrator) RdfWiringFactory(nl.knaw.huygens.timbuctoo.v5.graphql.datafetchers.RdfWiringFactory) ExecutorService(java.util.concurrent.ExecutorService)

Aggregations

Search (org.orcid.jaxb.model.search_v2.Search)10 List (java.util.List)9 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 Response (javax.ws.rs.core.Response)5 Result (org.orcid.jaxb.model.search_v2.Result)5 DBUnitTest (org.orcid.test.DBUnitTest)5 OrcidSearchManager (org.orcid.core.manager.OrcidSearchManager)4 OrcidSecurityManager (org.orcid.core.manager.OrcidSecurityManager)4 OrcidIdentifier (org.orcid.jaxb.model.common_v2.OrcidIdentifier)4 FundingList (org.orcid.jaxb.model.message.FundingList)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 IOException (java.io.IOException)2 URI (java.net.URI)2 Map (java.util.Map)2 Vres (nl.knaw.huygens.timbuctoo.model.vre.Vres)2 Autocomplete (nl.knaw.huygens.timbuctoo.server.endpoints.v2.domain.Autocomplete)2 PublicV2ApiServiceDelegatorImpl (org.orcid.api.publicV2.server.delegator.impl.PublicV2ApiServiceDelegatorImpl)2 BaseTest (org.orcid.core.BaseTest)2