congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
WorkflowId.toMetadataEntity
Code IndexAdd Tabnine to your IDE (free)

How to use
toMetadataEntity
method
in
co.cask.cdap.proto.id.WorkflowId

Best Java code snippets using co.cask.cdap.proto.id.WorkflowId.toMetadataEntity (Showing top 4 results out of 315)

origin: caskdata/cdap

@Test
public void testSystemMetadata() {
 MetadataEntity entity = NamespaceId.DEFAULT.app("appX").workflow("wtf").toMetadataEntity();
 store.replaceMetadata(MetadataScope.SYSTEM,
            new MetadataDataset.Record(
             entity,
             ImmutableMap.of("a", "b", "x", "y"),
             ImmutableSet.of("tag1", "tag2")),
            ImmutableSet.of("a"), ImmutableSet.of("x"));
 MetadataSearchResponse response = store.search(
  new SearchRequest(null, "tag1", Collections.emptySet(),
           SortInfo.DEFAULT, 0, Integer.MAX_VALUE, 0, null, false, EnumSet.allOf(EntityScope.class)));
 Set<MetadataSearchResultRecord> results = response.getResults();
 Assert.assertEquals(1, results.size());
 store.replaceMetadata(MetadataScope.SYSTEM,
            new MetadataDataset.Record(
             entity,
             ImmutableMap.of("a", "b", "x", "y"),
             ImmutableSet.of("tag1", "tag2")),
            ImmutableSet.of("a"), ImmutableSet.of("x"));
 response = store.search(
  new SearchRequest(null, "tag1", Collections.emptySet(),
           SortInfo.DEFAULT, 0, Integer.MAX_VALUE, 0, null, false, EnumSet.allOf(EntityScope.class)));
 results = response.getResults();
 Assert.assertEquals(1, results.size());
}
origin: caskdata/cdap

@Test
public void testSearchOnTagsUpdate() {
 MetadataEntity entity = NamespaceId.DEFAULT.app("appX").workflow("wtf").toMetadataEntity();
 store.addTags(MetadataScope.SYSTEM, entity, ImmutableSet.of("tag1", "tag2"));
 Assert.assertEquals(ImmutableSet.of("tag1", "tag2"), store.getTags(MetadataScope.SYSTEM, entity));
 MetadataSearchResponse response = store.search(
  new SearchRequest(null, "tag1", Collections.emptySet(),
           SortInfo.DEFAULT, 0, Integer.MAX_VALUE, 0, null, false, EnumSet.allOf(EntityScope.class)));
 Set<MetadataSearchResultRecord> results = response.getResults();
 Assert.assertEquals(1, results.size());
 // add an more tags
 store.addTags(MetadataScope.SYSTEM, entity, ImmutableSet.of("tag3", "tag4"));
 ImmutableSet<String> expectedTags = ImmutableSet.of("tag1", "tag2", "tag3", "tag4");
 Assert.assertEquals(expectedTags, store.getTags(MetadataScope.SYSTEM, entity));
 for (String expectedTag : expectedTags) {
  response = store.search(
   new SearchRequest(null, expectedTag, Collections.emptySet(),
            SortInfo.DEFAULT, 0, Integer.MAX_VALUE, 0, null, false, EnumSet.allOf(EntityScope.class)));
  results = response.getResults();
  Assert.assertEquals(1, results.size());
 }
 // add an empty set of tags. This should have no effect on retrieval or search of tags
 store.addTags(MetadataScope.SYSTEM, entity, ImmutableSet.of());
 Assert.assertEquals(expectedTags, store.getTags(MetadataScope.SYSTEM, entity));
 response = store.search(
  new SearchRequest(null, "tag1", Collections.emptySet(),
           SortInfo.DEFAULT, 0, Integer.MAX_VALUE, 0, null, false, EnumSet.allOf(EntityScope.class)));
 results = response.getResults();
 Assert.assertEquals(1, results.size());
}
origin: cdapio/cdap

@Test
public void testWorkflowTags() throws Exception {
 String appName = WorkflowAppWithFork.class.getSimpleName();
 ApplicationId appId = NamespaceId.DEFAULT.app(appName);
 String workflowName = WorkflowAppWithFork.WorkflowWithFork.class.getSimpleName();
 ArtifactId artifactId = NamespaceId.DEFAULT.artifact(appId.getApplication(), "1.0");
 ApplicationWithPrograms appWithPrograms = createAppWithWorkflow(artifactId, appId, workflowName);
 WorkflowSpecification workflowSpec = appWithPrograms.getSpecification().getWorkflows().get(workflowName);
 SystemMetadataWriterStage systemMetadataWriterStage = new SystemMetadataWriterStage(metadataPublisher);
 StageContext stageContext = new StageContext(Object.class);
 systemMetadataWriterStage.process(stageContext);
 systemMetadataWriterStage.process(appWithPrograms);
 // verify that the workflow is not tagged with the fork node name. First wait for tags to show up
 Tasks.waitFor(false, () -> metadataStore.getTags(
  MetadataScope.SYSTEM, appId.workflow(workflowName).toMetadataEntity()).isEmpty(), 5, TimeUnit.SECONDS);
 Set<String> workflowSystemTags = metadataStore.getTags(MetadataScope.SYSTEM,
                             appId.workflow(workflowName).toMetadataEntity());
 Sets.SetView<String> intersection = Sets.intersection(workflowSystemTags, getWorkflowForkNodes(workflowSpec));
 Assert.assertTrue("Workflows should not be tagged with fork node names, but found the following fork nodes " +
           "in the workflow's system tags: " + intersection, intersection.isEmpty());
 // verify that metadata was added for the workflow's schedule. First wait for the metadata to show up
 Tasks.waitFor(false, () -> metadataStore.getProperties(
  MetadataScope.SYSTEM, appId.toMetadataEntity()).isEmpty(), 5, TimeUnit.SECONDS);
 Map<String, String> metadataProperties = metadataStore.getMetadata(MetadataScope.SYSTEM,
                                   appId.toMetadataEntity()).getProperties();
 Assert.assertEquals(WorkflowAppWithFork.SCHED_NAME + ":testDescription",
           metadataProperties.get("schedule:" + WorkflowAppWithFork.SCHED_NAME));
}
origin: caskdata/cdap

@Test
public void testSearchOnTagsUpdate() throws IOException {
 MetadataStorage mds = getMetadataStorage();
 MetadataEntity entity = NamespaceId.DEFAULT.app("appX").workflow("wtf").toMetadataEntity();
 Metadata meta = new Metadata(SYSTEM, tags("tag1", "tag2"));
 mds.apply(new Update(entity, meta));
 Assert.assertEquals(meta.getTags(SYSTEM), mds.read(new Read(entity, SYSTEM)).getTags(SYSTEM));
 assertResults(mds, SearchRequest.of("tag1").build(), new MetadataRecord(entity, meta));
 // add an more tags
 mds.apply(new Update(entity, new Metadata(SYSTEM, tags("tag3", "tag4"))));
 Set<String> newTags = tags("tag1", "tag2", "tag3", "tag4");
 Metadata newMeta = new Metadata(SYSTEM, newTags);
 Assert.assertEquals(newTags, mds.read(new Read(entity, SYSTEM)).getTags(SYSTEM));
 for (String expectedTag : newTags) {
  assertResults(mds, SearchRequest.of(expectedTag).build(), new MetadataRecord(entity, newMeta));
 }
 // add an empty set of tags. This should have no effect on retrieval or search of tags
 mds.apply(new Update(entity, new Metadata(SYSTEM, tags())));
 Assert.assertEquals(newTags, mds.read(new Read(entity, SYSTEM)).getTags(SYSTEM));
 for (String expectedTag : newTags) {
  assertResults(mds, SearchRequest.of(expectedTag).build(), new MetadataRecord(entity, newMeta));
 }
 // clean up
 mds.apply(new Drop(entity));
}
co.cask.cdap.proto.idWorkflowIdtoMetadataEntity

Popular methods of WorkflowId

  • getProgram
  • run
  • <init>
  • getApplication
  • getParent
  • getNamespace
  • getNamespaceId
  • getVersion

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now