Package org.apache.oodt.cas.cli.action.CmdLineAction

Examples of org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter


      assertEquals(FILENAME_MET_VAL, clientSetMetadata.getMetadata(FILENAME_MET_KEY));
      assertEquals(NOMINAL_DATE_MET_VAL, clientSetMetadata.getMetadata(NOMINAL_DATE_MET_KEY));
   }

   public void testClientTransFalseAndFlatProduct() throws CmdLineActionException, IOException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockIngestProductCliAction cliAction = new MockIngestProductCliAction();
      cliAction.setProductName(PRODUCT_NAME);
      cliAction.setProductStructure(Product.STRUCTURE_FLAT);
      cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
      cliAction.setMetadataFile(metadataFile.getAbsolutePath());
      cliAction.setReferences(Lists.newArrayList(flatRefFile.getAbsolutePath()));
      cliAction.execute(printer);
      assertEquals(2, printer.getPrintedMessages().size());
      assertEquals("ingestProduct: Result: " + PRODUCT_ID, printer.getPrintedMessages().get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
      assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
      assertEquals(Product.STRUCTURE_FLAT, clientSetProduct.getProductStructure());
      assertEquals(PRODUCT_TYPE_NAME, clientSetProduct.getProductType().getName());
      assertEquals(1, clientSetProduct.getProductReferences().size());
      assertEquals("file:" + flatRefFile.getAbsolutePath(), clientSetProduct.getProductReferences().get(0).getOrigReference());
View Full Code Here


      assertEquals(FILENAME_MET_VAL, clientSetMetadata.getMetadata(FILENAME_MET_KEY));
      assertEquals(NOMINAL_DATE_MET_VAL, clientSetMetadata.getMetadata(NOMINAL_DATE_MET_KEY));
   }

   public void testClientTransTrueAndHierProduct() throws CmdLineActionException, IOException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockIngestProductCliAction cliAction = new MockIngestProductCliAction();
      cliAction.setProductName(PRODUCT_NAME);
      cliAction.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
      cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
      cliAction.setMetadataFile(metadataFile.getAbsolutePath());
      cliAction.setDataTransferer(DATA_TRANSFERER_FACTORY);
      cliAction.setReferences(Lists.newArrayList(hierRefFile.getAbsolutePath()));
      cliAction.execute(printer);
      assertEquals(2, printer.getPrintedMessages().size());
      assertEquals("ingestProduct: Result: " + PRODUCT_ID, printer.getPrintedMessages().get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
      assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
      assertEquals(Product.STRUCTURE_HIERARCHICAL, clientSetProduct.getProductStructure());
      assertEquals(PRODUCT_TYPE_NAME, clientSetProduct.getProductType().getName());
      assertEquals(3, clientSetProduct.getProductReferences().size());
      Collections.sort(clientSetProduct.getProductReferences(), new Comparator<Reference>() {
View Full Code Here

      assertEquals(FILENAME_MET_VAL, clientSetMetadata.getMetadata(FILENAME_MET_KEY));
      assertEquals(NOMINAL_DATE_MET_VAL, clientSetMetadata.getMetadata(NOMINAL_DATE_MET_KEY));
   }

   public void testClientTransFalseAndHierProduct() throws CmdLineActionException, IOException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockIngestProductCliAction cliAction = new MockIngestProductCliAction();
      cliAction.setProductName(PRODUCT_NAME);
      cliAction.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
      cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
      cliAction.setMetadataFile(metadataFile.getAbsolutePath());
      cliAction.setReferences(Lists.newArrayList(hierRefFile.getAbsolutePath()));
      cliAction.execute(printer);
      assertEquals(2, printer.getPrintedMessages().size());
      assertEquals("ingestProduct: Result: " + PRODUCT_ID, printer.getPrintedMessages().get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
      assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
      assertEquals(Product.STRUCTURE_HIERARCHICAL, clientSetProduct.getProductStructure());
      assertEquals(PRODUCT_TYPE_NAME, clientSetProduct.getProductType().getName());
      assertEquals(3, clientSetProduct.getProductReferences().size());
      Collections.sort(clientSetProduct.getProductReferences(), new Comparator<Reference>() {
View Full Code Here

            "PrintMessageAction", actions);
      AdvancedCmdLineOption printHelloWorldOption = (AdvancedCmdLineOption) getOptionByName(
            "printHelloWorld", options);
      printHelloWorldOption.getHandler().handleOption(printHelloWorldAction,
            createOptionInstance(printHelloWorldOption));
      ActionMessagePrinter printer = new ActionMessagePrinter();
      printHelloWorldAction.execute(printer);
      assertEquals(1, printer.getPrintedMessages().size());
      assertEquals("Hello World!", printer.getPrintedMessages().get(0));
   }
View Full Code Here

         return;
      }

      handle(cmdLineArgs);

      ActionMessagePrinter printer = new ActionMessagePrinter();
      cmdLineArgs.getSpecifiedAction().execute(printer);
      printActionMessages(printer.getPrintedMessages());
   }
View Full Code Here

  
   public void testFileDownload() throws Exception {
      DownloadCliAction da = new DownloadCliAction();
      da.setUrl("http://localhost/some/file");
      da.setProtocolManager(pm);
      da.execute(new ActionMessagePrinter());
      assertNotNull(da.getUsedProtocol());
      assertTrue(da.getUsedProtocol() instanceof MockProtocol);
      assertEquals(1, ((MockProtocol) da.getUsedProtocol()).getGetFiles().size());
      assertEquals("/some/file", ((MockProtocol) da.getUsedProtocol()).getGetFiles().get(0).getPath());
   }
View Full Code Here

               Authentication auth) {
            return auth != null && site.toString().equals("http://localhost");
         }
      });
      bva.setProtocolManager(new ProtocolManager(new MockSpringProtocolConfig()));
      bva.execute(new ActionMessagePrinter());
      assertTrue(bva.getLastVerificationResults());
   }
View Full Code Here

      // Load and verify PrintMessageAction was loaded correctly.
      CmdLineAction action = findAction("PrintMessageAction", actions);
      assertTrue(action instanceof PrintMessageAction);
      PrintMessageAction pma = (PrintMessageAction) action;
      assertEquals("Prints out a given message", pma.getDescription());
      ActionMessagePrinter printer = new ActionMessagePrinter();
      try {
         pma.execute(printer);
         fail("Should have thrown IllegalArgumentException");
      } catch (IllegalArgumentException e) { /* do nothing */ }
      assertEquals(0, printer.getPrintedMessages().size());

      // Load and verify PrintHelloWorldAction was loaded correctly.
      action = findAction("PrintHelloWorldAction", actions);
      assertTrue(action instanceof PrintMessageAction);
      pma = (PrintMessageAction) action;
      assertEquals("Prints out 'Hello World'", pma.getDescription());
      assertEquals("Hello World", pma.getMessage());
      pma.execute(printer);
      assertEquals(1, printer.getPrintedMessages().size());
      assertEquals(pma.getMessage(), printer.getPrintedMessages().get(0));
   }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.cli.action.CmdLineAction.ActionMessagePrinter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.