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

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


   private static final String TEST_FILENAME = "data.dat";

   private ComplexQuery clientSetQuery;

   public void testValidation() {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockLuceneQueryCliAction cliAction = new MockLuceneQueryCliAction();
      cliAction.setQuery("ProductId=TestProductId");
      try {
         cliAction.execute(printer);
         fail("Should have throw exception");
View Full Code Here


      }
   }

   public void testClientTransTrueAndFlatProduct()
         throws CmdLineActionException, IOException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockLuceneQueryCliAction cliAction = new MockLuceneQueryCliAction();

      cliAction.setQuery("ProductId:TestProductId");
      cliAction.execute(printer);
      assertEquals(1, clientSetQuery.getCriteria().size());
View Full Code Here

   private static final String PRODUCT_STRUCTURE = "Flat";
   private static final String PRODUCT_STATUS = "DONE";
   private static final String PRODUCT_TYPE_NAME = "TestProductType";

   public void testValidateErrors() {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockGetLastPageCliAction cliAction = new MockGetLastPageCliAction();
      try {
         cliAction.execute(printer);
         fail("Expected throw CmdLineActionException");
      } catch (CmdLineActionException ignore) {
View Full Code Here

      } catch (CmdLineActionException ignore) {
      }
   }

   public void testDataFlow() throws CmdLineActionException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockGetLastPageCliAction cliAction = new MockGetLastPageCliAction();
      cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
      cliAction.execute(printer);
      assertEquals(6, printer.getPrintedMessages().size());
      assertEquals("Page: [num=" + PAGE_NUM + ", totalPages=" + TOTAL_PAGES
            + ", pageSize=" + PAGE_SIZE + "]", printer.getPrintedMessages()
            .get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
      assertEquals("Products:", printer.getPrintedMessages().get(2));
      assertEquals("\n", printer.getPrintedMessages().get(3));
      assertEquals("Product: [id=" + PRODUCT_ID + ",name=" + PRODUCT_NAME
            + ",type=" + PRODUCT_TYPE_NAME + ",structure=" + PRODUCT_STRUCTURE
            + ", transferStatus=" + PRODUCT_STATUS + "]", printer
            .getPrintedMessages().get(4));
      assertEquals("\n", printer.getPrintedMessages().get(5));
   }
View Full Code Here

   private static final String PRODUCT_NAME = "ProductName";

   private static FileTransferStatus status;

   public void testValidateErrors() {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      NullStatusGetCurrentTransferCliAction cliAction = new NullStatusGetCurrentTransferCliAction();
      try {
         cliAction.execute(printer);
         fail("Expected throw CmdLineActionException");
      } catch (CmdLineActionException ignore) {
View Full Code Here

      } catch (CmdLineActionException ignore) {
      }
   }

   public void testDataFlow() throws CmdLineActionException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockGetCurrentTransferCliAction cliAction = new MockGetCurrentTransferCliAction();
      cliAction.execute(printer);
      assertEquals(2, printer.getPrintedMessages().size());
      assertEquals("File Transfer: [ref={orig=" + ORIG_REF + ",ds=" + DS_REF
            + "},product=" + PRODUCT_NAME + ",fileSize=" + FILE_SIZE
            + ",amtTransferred=" + BYTE_TRANS + ",pct=0.5]", printer
            .getPrintedMessages().get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
   }
View Full Code Here

   private static final String PRODUCT_STRUCTURE = "Flat";
   private static final String PRODUCT_STATUS = "DONE";
   private static final String PRODUCT_TYPE_NAME = "TestProductType";

   public void testValidateErrors() {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockGetNextPageCliAction cliAction = new MockGetNextPageCliAction();
      try {
         cliAction.execute(printer);
         fail("Expected throw CmdLineActionException");
      } catch (CmdLineActionException ignore) {
View Full Code Here

      } catch (CmdLineActionException ignore) {
      }
   }

   public void testDataFlow() throws CmdLineActionException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      MockGetNextPageCliAction cliAction = new MockGetNextPageCliAction();
      cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
      cliAction.setCurrentPageNum(PAGE_NUM);
      cliAction.execute(printer);
      assertEquals(6, printer.getPrintedMessages().size());
      assertEquals("Page: [num=" + (PAGE_NUM + 1) + ", totalPages="
            + TOTAL_PAGES + ", pageSize=" + PAGE_SIZE + "]", printer
            .getPrintedMessages().get(0));
      assertEquals("\n", printer.getPrintedMessages().get(1));
      assertEquals("Products:", printer.getPrintedMessages().get(2));
      assertEquals("\n", printer.getPrintedMessages().get(3));
      assertEquals("Product: [id=" + PRODUCT_ID_4 + ",name=" + PRODUCT_NAME_4
            + ",type=" + PRODUCT_TYPE_NAME + ",structure=" + PRODUCT_STRUCTURE
            + ", transferStatus=" + PRODUCT_STATUS + "]", printer
            .getPrintedMessages().get(4));
      assertEquals("\n", printer.getPrintedMessages().get(5));
   }
View Full Code Here

   public void tearDown() throws Exception {
      FileUtils.forceDelete(tmpDir);
   }

   public void testValidateErrors() throws CmdLineActionException {
      ActionMessagePrinter printer = new ActionMessagePrinter();
      IngestProductCliAction cliAction = new MockIngestProductCliAction();
      try {
         cliAction.execute(printer);
         fail("Expected throw CmdLineActionException");
      } catch (CmdLineActionException ignore) {
View Full Code Here

      } catch (CmdLineActionException ignore) {
      }
   }
  
   public void testClientTransTrueAndFlatProduct() 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.setDataTransferer(DATA_TRANSFERER_FACTORY);
      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

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.