congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
AbstractVerifier.verify
Code IndexAdd Tabnine to your IDE (free)

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

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

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());
}
co.cask.cdap.app.verificationAbstractVerifierverify

Popular methods of AbstractVerifier

  • getName

Popular in Java

  • Reading from database using SQL prepared statement
  • compareTo (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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