@Test public void testSearchArtifactsByKeyExact() throws Exception { try (RepositorySession session = sessionFactory.createSession()) { createArtifactWithData( session ); } try (RepositorySession session = sessionFactory.createSession()) { session.refreshAndDiscard(); tryAssert(() -> { Session jcrSession = ( (JcrRepositorySession) session ).getJcrSession( ); assertThat(jcrSession.propertyExists( "/repositories/test/content/mytest/myproject/1.0/url" )).isTrue(); Collection<ArtifactMetadata> artifactsByProperty = repository.searchArtifacts( session, TEST_REPO_ID, "url", TEST_URL, true); assertThat(artifactsByProperty).describedAs( "Artifact search by url=%s must give a result.", TEST_URL ).isNotNull().isNotEmpty(); artifactsByProperty = repository.searchArtifacts( session, TEST_REPO_ID, "org.name", "pache", true ); assertThat( artifactsByProperty ).describedAs( "Artifact search by text org.name='pache' must be empty" ).isNotNull( ).isEmpty( ); } ); } }
@Override public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact) throws MetadataRepositoryException { return searchArtifacts(session, repositoryId, null, text, exact); }
JcrMetadataRepository extends AbstractMetadataRepository implements MetadataRepository, RepositoryStatisticsProvider { @Override public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact) throws MetadataRepositoryException { return searchArtifacts(session, repositoryId, null, text, exact); } }
JcrMetadataRepository extends AbstractMetadataRepository implements MetadataRepository, RepositoryStatisticsProvider { @Override public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact) throws MetadataRepositoryException { return searchArtifacts(session, repositoryId, null, text, exact); } JcrMetadataRepository(MetadataService metadataService, Repository repository); }
JcrMetadataRepository extends AbstractMetadataRepository implements MetadataRepository, RepositoryStatisticsProvider { @Override public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact) throws MetadataRepositoryException { return searchArtifacts(session, repositoryId, null, text, exact); } JcrMetadataRepository(MetadataService metadataService, Repository repository); static void initializeNodeTypes(Session session); @Override void updateProject(RepositorySession session, String repositoryId, ProjectMetadata project); @Override void updateArtifact(RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
                               ArtifactMetadata artifactMeta); @Override void updateProjectVersion(RepositorySession session, String repositoryId, String namespace, String projectId,
                                     ProjectVersionMetadata versionMetadata); @Override void updateNamespace(RepositorySession session, String repositoryId, String namespace); @Override void removeProject(RepositorySession session, String repositoryId, String namespace, String projectId); @Override boolean hasMetadataFacet(RepositorySession session, String repositoryId, String facetId); @Override List<String> getMetadataFacets(RepositorySession session, String repositoryId, String facetId); @Override Stream<T> getMetadataFacetStream(RepositorySession session, String repositoryId, Class<T> facetClazz, QueryParameter queryParameter); @Override T getMetadataFacet(RepositorySession session, String repositoryId, Class<T> clazz, String name); @Override void addMetadataFacet(RepositorySession session, String repositoryId, MetadataFacet metadataFacet); @Override void removeNamespace(RepositorySession session, String repositoryId, String projectId); @Override void removeMetadataFacets(RepositorySession session, String repositoryId, String facetId); @Override void removeMetadataFacet(RepositorySession session, String repositoryId, String facetId, String name); @Override List<ArtifactMetadata> getArtifactsByDateRange(RepositorySession session, String repoId, ZonedDateTime startTime, ZonedDateTime endTime, QueryParameter queryParameter); @Override Stream<ArtifactMetadata> getArtifactByDateRangeStream(RepositorySession session, String repositoryId, ZonedDateTime startTime, ZonedDateTime endTime, QueryParameter queryParameter); @Override List<ArtifactMetadata> getArtifactsByChecksum(RepositorySession session, String repositoryId, String checksum); List<ArtifactMetadata> runJcrQuery(Session jcrSession, String repositoryId, String q, Map<String, String> bindingParam); List<ArtifactMetadata> runJcrQuery(final Session jcrSession, final String repositoryId, final String qParam,
                                              final Map<String, String> bindingParam, final boolean checkPath); QueryResult runNativeJcrQuery(final Session jcrSession, final String q, final Map<String, String> bindingParam); QueryResult runNativeJcrQuery(final Session jcrSession, final String q, final Map<String, String> bindingParam, long offset, long maxEntries); @Override List<ArtifactMetadata> getArtifactsByProjectVersionFacet(RepositorySession session, String key, String value, String repositoryId); @Override List<ArtifactMetadata> getArtifactsByAttribute(RepositorySession session, String key, String value, String repositoryId); @Override List<ArtifactMetadata> getArtifactsByProjectVersionAttribute(RepositorySession session, String key, String value, String repositoryId); @Override void removeRepository(RepositorySession session, String repositoryId); @Override List<ArtifactMetadata> getArtifacts(RepositorySession session, String repositoryId); @Override ProjectMetadata getProject(RepositorySession session, String repositoryId, String namespace, String projectId); @Override ProjectVersionMetadata getProjectVersion(RepositorySession session, String repositoryId, String namespace, String projectId,
                                                    String projectVersion); @Override List<String> getArtifactVersions(RepositorySession session, String repositoryId, String namespace, String projectId,
                                            String projectVersion); @Override List<ProjectVersionReference> getProjectReferences(RepositorySession session, String repositoryId, String namespace,
                                                              String projectId, String projectVersion); @Override List<String> getRootNamespaces(RepositorySession session, String repositoryId); @Override List<String> getChildNamespaces(RepositorySession session, String repositoryId, String baseNamespace); @Override List<String> getProjects(RepositorySession session, String repositoryId, String namespace); @Override List<String> getProjectVersions(RepositorySession session, String repositoryId, String namespace, String projectId); @Override void removeTimestampedArtifact(RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion); @Override void removeProjectVersion(RepositorySession session, String repoId, String namespace, String projectId, String projectVersion); @Override void removeArtifact(RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
                               String id); @Override void removeFacetFromArtifact(RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
                                        MetadataFacet metadataFacet); @Override List<ArtifactMetadata> getArtifacts(RepositorySession session, String repositoryId, String namespace, String projectId,
                                               String projectVersion); @Override void close(); @Override List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact); @Override List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String key, String text, boolean exact); @Override void populateStatistics(RepositorySession repositorySession, MetadataRepository repository, String repositoryId,
                                   RepositoryStatistics repositoryStatistics); Session login(); @Override Stream<ArtifactMetadata> getArtifactStream(final RepositorySession session, final String repositoryId,
                                                      final String namespace, final String projectId, final String projectVersion,
                                                      final QueryParameter queryParameter); @Override Stream<ArtifactMetadata> getArtifactStream(final RepositorySession session, final String repositoryId,
                                                      final QueryParameter queryParameter); }
JcrMetadataRepository extends AbstractMetadataRepository implements MetadataRepository, RepositoryStatisticsProvider { @Override public List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact) throws MetadataRepositoryException { return searchArtifacts(session, repositoryId, null, text, exact); } JcrMetadataRepository(MetadataService metadataService, Repository repository); static void initializeNodeTypes(Session session); @Override void updateProject(RepositorySession session, String repositoryId, ProjectMetadata project); @Override void updateArtifact(RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
                               ArtifactMetadata artifactMeta); @Override void updateProjectVersion(RepositorySession session, String repositoryId, String namespace, String projectId,
                                     ProjectVersionMetadata versionMetadata); @Override void updateNamespace(RepositorySession session, String repositoryId, String namespace); @Override void removeProject(RepositorySession session, String repositoryId, String namespace, String projectId); @Override boolean hasMetadataFacet(RepositorySession session, String repositoryId, String facetId); @Override List<String> getMetadataFacets(RepositorySession session, String repositoryId, String facetId); @Override Stream<T> getMetadataFacetStream(RepositorySession session, String repositoryId, Class<T> facetClazz, QueryParameter queryParameter); @Override T getMetadataFacet(RepositorySession session, String repositoryId, Class<T> clazz, String name); @Override void addMetadataFacet(RepositorySession session, String repositoryId, MetadataFacet metadataFacet); @Override void removeNamespace(RepositorySession session, String repositoryId, String projectId); @Override void removeMetadataFacets(RepositorySession session, String repositoryId, String facetId); @Override void removeMetadataFacet(RepositorySession session, String repositoryId, String facetId, String name); @Override List<ArtifactMetadata> getArtifactsByDateRange(RepositorySession session, String repoId, ZonedDateTime startTime, ZonedDateTime endTime, QueryParameter queryParameter); @Override Stream<ArtifactMetadata> getArtifactByDateRangeStream(RepositorySession session, String repositoryId, ZonedDateTime startTime, ZonedDateTime endTime, QueryParameter queryParameter); @Override List<ArtifactMetadata> getArtifactsByChecksum(RepositorySession session, String repositoryId, String checksum); List<ArtifactMetadata> runJcrQuery(Session jcrSession, String repositoryId, String q, Map<String, String> bindingParam); List<ArtifactMetadata> runJcrQuery(final Session jcrSession, final String repositoryId, final String qParam,
                                              final Map<String, String> bindingParam, final boolean checkPath); QueryResult runNativeJcrQuery(final Session jcrSession, final String q, final Map<String, String> bindingParam); QueryResult runNativeJcrQuery(final Session jcrSession, final String q, final Map<String, String> bindingParam, long offset, long maxEntries); @Override List<ArtifactMetadata> getArtifactsByProjectVersionFacet(RepositorySession session, String key, String value, String repositoryId); @Override List<ArtifactMetadata> getArtifactsByAttribute(RepositorySession session, String key, String value, String repositoryId); @Override List<ArtifactMetadata> getArtifactsByProjectVersionAttribute(RepositorySession session, String key, String value, String repositoryId); @Override void removeRepository(RepositorySession session, String repositoryId); @Override List<ArtifactMetadata> getArtifacts(RepositorySession session, String repositoryId); @Override ProjectMetadata getProject(RepositorySession session, String repositoryId, String namespace, String projectId); @Override ProjectVersionMetadata getProjectVersion(RepositorySession session, String repositoryId, String namespace, String projectId,
                                                    String projectVersion); @Override List<String> getArtifactVersions(RepositorySession session, String repositoryId, String namespace, String projectId,
                                            String projectVersion); @Override List<ProjectVersionReference> getProjectReferences(RepositorySession session, String repositoryId, String namespace,
                                                              String projectId, String projectVersion); @Override List<String> getRootNamespaces(RepositorySession session, String repositoryId); @Override List<String> getChildNamespaces(RepositorySession session, String repositoryId, String baseNamespace); @Override List<String> getProjects(RepositorySession session, String repositoryId, String namespace); @Override List<String> getProjectVersions(RepositorySession session, String repositoryId, String namespace, String projectId); @Override void removeTimestampedArtifact(RepositorySession session, ArtifactMetadata artifactMetadata, String baseVersion); @Override void removeProjectVersion(RepositorySession session, String repoId, String namespace, String projectId, String projectVersion); @Override void removeArtifact(RepositorySession session, String repositoryId, String namespace, String projectId, String projectVersion,
                               String id); @Override void removeFacetFromArtifact(RepositorySession session, String repositoryId, String namespace, String project, String projectVersion,
                                        MetadataFacet metadataFacet); @Override List<ArtifactMetadata> getArtifacts(RepositorySession session, String repositoryId, String namespace, String projectId,
                                               String projectVersion); @Override void close(); @Override List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String text, boolean exact); @Override List<ArtifactMetadata> searchArtifacts(RepositorySession session, String repositoryId, String key, String text, boolean exact); @Override void populateStatistics(RepositorySession repositorySession, MetadataRepository repository, String repositoryId,
                                   RepositoryStatistics repositoryStatistics); Session login(); @Override Stream<ArtifactMetadata> getArtifactStream(final RepositorySession session, final String repositoryId,
                                                      final String namespace, final String projectId, final String projectVersion,
                                                      final QueryParameter queryParameter); @Override Stream<ArtifactMetadata> getArtifactStream(final RepositorySession session, final String repositoryId,
                                                      final QueryParameter queryParameter);  }