Search in sources :

Example 11 with QueryParam

use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.

the class StreamCatalogService method removeAllTopologyTestSources.

private void removeAllTopologyTestSources(TopologySource topologySource) {
    QueryParam sourceIdQuery = new QueryParam("sourceId", String.valueOf(topologySource.getId()));
    Collection<TopologyTestRunCaseSource> sources = listTopologyTestRunCaseSource(Collections.singletonList(sourceIdQuery));
    if (sources != null) {
        sources.forEach(s -> removeTopologyTestRunCaseSource(s.getId()));
    }
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) TopologyTestRunCaseSource(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)

Example 12 with QueryParam

use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.

the class StreamCatalogService method getTopologyTestRunCaseSourceBySourceId.

public TopologyTestRunCaseSource getTopologyTestRunCaseSourceBySourceId(Long testCaseId, Long sourceId) {
    TopologyTestRunCaseSource testCaseSource = new TopologyTestRunCaseSource();
    testCaseSource.setId(testCaseId);
    Collection<TopologyTestRunCaseSource> sources = dao.find(TopologyTestRunCaseSource.NAMESPACE, Lists.newArrayList(new QueryParam("testCaseId", testCaseId.toString()), new QueryParam("sourceId", sourceId.toString())));
    if (sources == null || sources.isEmpty()) {
        return null;
    } else if (sources.size() > 1) {
        LOG.warn("More than one test run case source entity for same test case and source. test case id: " + testCaseId + " , source id: " + sourceId);
        LOG.warn("Returning first one...");
    }
    return sources.iterator().next();
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) TopologyTestRunCaseSource(com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)

Example 13 with QueryParam

use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.

the class StreamCatalogService method addCustomProcessorInfoAsBundle.

public CustomProcessorInfo addCustomProcessorInfoAsBundle(CustomProcessorInfo customProcessorInfo, InputStream jarFile) throws IOException, ComponentConfigException, NoSuchAlgorithmException {
    List<QueryParam> queryParams = new ArrayList<>();
    queryParams.add(new QueryParam(CustomProcessorInfo.NAME, customProcessorInfo.getName()));
    Collection<TopologyComponentBundle> result = this.listCustomProcessorBundlesWithFilter(queryParams);
    if (!result.isEmpty()) {
        throw new IOException("Custom processor already exists with name:" + customProcessorInfo.getName());
    }
    this.handleCustomProcessorJar(jarFile, customProcessorInfo, true);
    TopologyComponentBundle topologyComponentBundle = customProcessorInfo.toTopologyComponentBundle();
    this.addTopologyComponentBundle(topologyComponentBundle, null);
    return customProcessorInfo;
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) IOException(java.io.IOException) TopologyComponentBundle(com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)

Example 14 with QueryParam

use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.

the class StreamCatalogService method listTopologyTestRunCaseSource.

public Collection<TopologyTestRunCaseSource> listTopologyTestRunCaseSource(Long testCaseId) {
    List<QueryParam> queryParams = new ArrayList<>();
    queryParams.add(new QueryParam("testCaseId", String.valueOf(testCaseId)));
    return dao.find(TopologyTestRunCaseSource.NAMESPACE, queryParams);
}
Also used : QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList)

Example 15 with QueryParam

use of com.hortonworks.registries.common.QueryParam in project streamline by hortonworks.

the class StreamCatalogService method listTopologyEditorMetadata.

public Collection<TopologyEditorMetadata> listTopologyEditorMetadata() {
    List<TopologyEditorMetadata> metadatas = new ArrayList<>();
    Collection<TopologyVersion> currentVersions = listCurrentTopologyVersionInfos();
    for (TopologyVersion version : currentVersions) {
        List<QueryParam> queryParams = WSUtils.buildTopologyIdAndVersionIdAwareQueryParams(version.getTopologyId(), version.getId(), null);
        metadatas.addAll(listTopologyEditorMetadata(queryParams));
    }
    return metadatas;
}
Also used : TopologyVersion(com.hortonworks.streamline.streams.catalog.TopologyVersion) QueryParam(com.hortonworks.registries.common.QueryParam) WSUtils.versionIdQueryParam(com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam) WSUtils.buildEdgesFromQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam) WSUtils.currentVersionQueryParam(com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam) WSUtils.buildEdgesToQueryParam(com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam) ArrayList(java.util.ArrayList) TopologyEditorMetadata(com.hortonworks.streamline.streams.catalog.TopologyEditorMetadata)

Aggregations

QueryParam (com.hortonworks.registries.common.QueryParam)72 ArrayList (java.util.ArrayList)42 WSUtils.buildEdgesFromQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesFromQueryParam)22 WSUtils.buildEdgesToQueryParam (com.hortonworks.streamline.common.util.WSUtils.buildEdgesToQueryParam)22 WSUtils.currentVersionQueryParam (com.hortonworks.streamline.common.util.WSUtils.currentVersionQueryParam)22 WSUtils.versionIdQueryParam (com.hortonworks.streamline.common.util.WSUtils.versionIdQueryParam)22 IOException (java.io.IOException)8 SchemaNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaNotFoundException)7 StorableKey (com.hortonworks.registries.storage.StorableKey)7 OrderByField (com.hortonworks.registries.storage.OrderByField)6 HashSet (java.util.HashSet)6 SchemaVersionLifecycleContext (com.hortonworks.registries.schemaregistry.state.SchemaVersionLifecycleContext)5 TopologyComponentBundle (com.hortonworks.streamline.streams.catalog.topology.TopologyComponentBundle)5 Timed (com.codahale.metrics.annotation.Timed)4 Preconditions (com.google.common.base.Preconditions)4 SchemaBranchNotFoundException (com.hortonworks.registries.schemaregistry.errors.SchemaBranchNotFoundException)4 StorageException (com.hortonworks.registries.storage.exception.StorageException)4 TopologyTestRunCaseSource (com.hortonworks.streamline.streams.catalog.TopologyTestRunCaseSource)4 InputStream (java.io.InputStream)4 HashMap (java.util.HashMap)4