Codota Logo
AbstractVerifier
Code IndexAdd Codota to your IDE (free)

How to use
AbstractVerifier
in
co.cask.cdap.app.verification

Best Java code snippets using co.cask.cdap.app.verification.AbstractVerifier (Showing top 5 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: co.cask.cdap/cdap-app-fabric

@Override
public VerifyResult verify(ApplicationId appId, T input) {
 // Checks if DataSet name is an ID
 String name = getName(input);
 if (!EntityId.isValidId(name)) {
  return VerifyResult.failure(Err.NOT_AN_ID, name);
 }
 return VerifyResult.success();
}
protected abstract String getName(T input);
origin: co.cask.cdap/cdap-app-fabric

/**
 * Verifies {@link ApplicationSpecification} being provide.
 *
 * @param input to be verified
 * @return An instance of {@link VerifyResult} depending of status of verification.
 */
@Override
public VerifyResult verify(ApplicationId appId, final ApplicationSpecification input) {
 VerifyResult verifyResult = super.verify(appId, input);
 if (!verifyResult.isSuccess()) {
  return verifyResult;
 }
 // Check if there is at least one of the following : Flow or MapReduce or Workflow for now.
 // TODO (terence): Logic here is really not good. Need to refactor.
 if (input.getFlows().isEmpty()
   && input.getMapReduce().isEmpty()
   && input.getSpark().isEmpty()
   && input.getWorkflows().isEmpty()
   && input.getServices().isEmpty()
   && input.getWorkers().isEmpty()) {
  return VerifyResult.failure(Err.Application.ATLEAST_ONE_PROCESSOR, input.getName());
 }
 return VerifyResult.success();
}
origin: cdapio/cdap

/**
 * Verifies {@link ApplicationSpecification} being provide.
 *
 * @param input to be verified
 * @return An instance of {@link VerifyResult} depending of status of verification.
 */
@Override
public VerifyResult verify(ApplicationId appId, final ApplicationSpecification input) {
 VerifyResult verifyResult = super.verify(appId, input);
 if (!verifyResult.isSuccess()) {
  return verifyResult;
 }
 // Check if there is at least one program
 // Loop through all program types. For each program type, get the number of programs of that type.
 // Then sum up total number of programs.
 int numberOfPrograms = Arrays.stream(ProgramType.values())
  .mapToInt(t -> input.getProgramsByType(t).size())
  .reduce(0, (l, r) -> l + r);
 if (numberOfPrograms <= 0) {
  return VerifyResult.failure(Err.Application.ATLEAST_ONE_PROCESSOR, input.getName());
 }
 return VerifyResult.success();
}
origin: cdapio/cdap

/**
 * Checking if name is an id or no.
 */
@Test
public void testId() throws Exception {
 AbstractVerifier<String> v = new AbstractVerifier<String>() {
  @Override
  protected String getName(String input) {
   return input;
  }
 };
 ApplicationId appId = new ApplicationId("test", "some");
 Assert.assertTrue(v.verify(appId, "foo").isSuccess());
 Assert.assertTrue(v.verify(appId, "mydataset").isSuccess());
 Assert.assertFalse(v.verify(appId, "foo name").isSuccess());
 Assert.assertTrue(v.verify(appId, "foo-name").isSuccess());
 Assert.assertTrue(v.verify(appId, "foo_name").isSuccess());
 Assert.assertTrue(v.verify(appId, "foo1234").isSuccess());
 Assert.assertFalse(v.verify(appId, "foo^ name").isSuccess());
 Assert.assertFalse(v.verify(appId, "foo^name").isSuccess());
 Assert.assertFalse(v.verify(appId, "foo/name").isSuccess());
 Assert.assertFalse(v.verify(appId, "foo$name").isSuccess());
}
origin: cdapio/cdap

@Override
public VerifyResult verify(ApplicationId appId, T input) {
 // Checks if DataSet name is an ID
 String name = getName(input);
 if (!EntityId.isValidId(name)) {
  return VerifyResult.failure(Err.NOT_AN_ID, name);
 }
 return VerifyResult.success();
}
protected abstract String getName(T input);
co.cask.cdap.app.verificationAbstractVerifier

Most used methods

  • verify
  • getName

Popular in Java

  • Reactive rest calls using spring rest template
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • orElseThrow (Optional)
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • Menu (java.awt)
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Vector (java.util)
    The Vector class implements a growable array of objects. Like an array, it contains components that
  • JTextField (javax.swing)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now