Package org.apache.oodt.cas.metadata

Examples of org.apache.oodt.cas.metadata.Metadata


    when(configuration.containsKey("HourKey")).thenReturn(true);
    when(configuration.containsKey("MinuteKey")).thenReturn(true);
    when(configuration.containsKey("SecondKey")).thenReturn(true);

    extractor.configure(configuration);
    Metadata extractedMetadata = extractor.doExtract(null, metadata);

    assertThat(extractedMetadata.getMetadata("StartYear"), is("2013"));
    assertThat(extractedMetadata.getMetadata("StartMonth"), is("05"));
    assertThat(extractedMetadata.getMetadata("StartDay"), is("23"));
    assertThat(extractedMetadata.getMetadata("StartHour"), is("03"));
    assertThat(extractedMetadata.getMetadata("StartMinute"), is("02"));
    assertThat(extractedMetadata.getMetadata("StartSecond"), is("01"));
  }
View Full Code Here


    when(configuration.containsKey("YearKey")).thenReturn(true);
    when(configuration.containsKey("MonthKey")).thenReturn(true);
    when(configuration.containsKey("DayKey")).thenReturn(true);

    extractor.configure(configuration);
    Metadata extractedMetadata = extractor.doExtract(null, metadata);

    assertThat(extractedMetadata.getMetadata("StartYear"), is("2013"));
    assertThat(extractedMetadata.getMetadata("StartMonth"), is("05"));
    assertThat(extractedMetadata.getMetadata("StartDay"), is("23"));
    assertThat(extractedMetadata.containsKey("StartHour"), is(false));
    assertThat(extractedMetadata.containsKey("StartMinute"), is(false));
    assertThat(extractedMetadata.containsKey("StartSecond"), is(false));
  }
View Full Code Here

            @Override
            public List<QueryResult> complexQuery(ComplexQuery complexQuery) {
               clientSetComplexQuery = complexQuery;
               Product p = new Product();
               p.setProductId("TestProductId");
               Metadata m = new Metadata();
               m.addMetadata("Filename", TEST_FILENAME);
               m.addMetadata("Owners", Lists.newArrayList("Bob", "Billy"));
               QueryResult qr = new QueryResult(p, m);
               qr.setToStringFormat(complexQuery.getToStringResultFormat());
               return Lists.newArrayList(qr);
            }
         };
View Full Code Here

            fail(e.getMessage());
        }
    }

    public void testIngest() {
        Metadata prodMet = null;

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
            ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(
                refUrl.getFile()), prodMet);
        } catch (Exception e) {
            fail(e.getMessage());
View Full Code Here

        // Reset the System properties to initial values.
        System.setProperties(initialProperties);
    }

    private void ingestTestFile() {
        Metadata prodMet = null;
        StdIngester ingester = new StdIngester(transferServiceFacClass);

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
            ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(
                refUrl.getFile()), prodMet);
        } catch (Exception e) {
            fail(e.getMessage());
View Full Code Here

               p.setProductId(productId);
               return p;
            }
            @Override
            public Metadata getMetadata(Product product) {
               Metadata m = new Metadata();
               m.addMetadata(FILENAME, FILE_NAME);
               return m;
            }
         };
      }
View Full Code Here

        // Reset the System properties to initial values.
        System.setProperties(initialProperties);
    }

    private void doIngest() {
        Metadata prodMet = null;

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
            ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(
                refUrl.getFile()), prodMet);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

    public TestStdIngester() {
        ingester = new StdIngester(transferServiceFacClass);
    }

    public void testIngest() {
        Metadata prodMet = null;

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
            ingester.ingest(new URL("http://localhost:" + FM_PORT), new File(
                refUrl.getFile()), prodMet);
        } catch (Exception e) {
            fail(e.getMessage());
View Full Code Here

        // add catPageSize of the test Product
        // then add a product called "ShouldBeFirstForPage.txt"
        // make sure it's the first one on the 1st page

        Product testProd = getTestProduct();
        Metadata met = getTestMetadata("test");

        for (int i = 0; i < this.catPageSize; i++) {
            try {
                myCat.addProduct(testProd);
                myCat.addMetadata(met, testProd);
            } catch (Exception e) {
                fail(e.getMessage());
            }
        }

        testProd.setProductName("ShouldBeFirstForPage.txt");
        met.replaceMetadata("CAS.ProdutName", "ShouldBeFirstForPage.txt");

        try {
            myCat.addProduct(testProd);
            myCat.addMetadata(met, testProd);
View Full Code Here

        }

    }

    public void testAddMetadata() {
        Metadata met = new Metadata();
        met.addMetadata("ProductStructure", Product.STRUCTURE_FLAT);

        Product testProduct = getTestProduct();
        testProduct.setProductId("1"); // need to link metadata to prod

        try {
            myCat.addMetadata(met, testProduct);
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        }

        try {
            Metadata retMet = myCat.getMetadata(testProduct);
            assertNotNull(retMet);
            assertTrue(retMet.containsKey(CoreMetKeys.PRODUCT_STRUCTURE));
            assertEquals(Product.STRUCTURE_FLAT, retMet
                    .getMetadata(CoreMetKeys.PRODUCT_STRUCTURE));
        } catch (CatalogException e) {
            fail(e.getMessage());
        }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.metadata.Metadata

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.