@SuppressWarnings({"rawtypes"})
 @Test
 public void testGetAttachemts() throws ParseException {
   SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
   // Date validAtDate = formatter.parse("8/26/2011");
   Date validAtDate = new Date();
   Date asOfDate = new Date();
   System.out.println("TemporalReferenceGetAttachmentsTest.testGetAttachemts()");
   System.out.println("--------------------------------------------------------");
   portfolioBiz.setReference(true);
   AttachmentSet<String> as = new AttachmentSetFactory().createAttachmentSet();
   HashSet<String> set = new HashSet<String>();
   set.add("a");
   set.add("ab");
   as.setAttachments(set);
   long startTime = System.currentTimeMillis();
   as.setGridPath("portfolio");
   List<KeyMap> list = portfolioBiz.getAttachments(as, validAtDate.getTime());
   long delta = System.currentTimeMillis() - startTime;
   for (KeyMap keyMap : list) {
     JsonLite jl = (JsonLite) keyMap;
     System.out.println(jl.toString(2, true, false));
   }
   System.out.println();
   System.out.println("Elapsed time (msec): " + delta);
   System.out.println();
 }
Example #2
0
 @Test
 public void testPageSearch() throws Exception {
   System.out.println("testPageSearch");
   System.out.println("==============");
   String pql = "account?";
   int pageSize = 100;
   IScrollableResultSet<TemporalEntry<ITemporalKey<String>, ITemporalData<String>>> sr =
       temporalBiz.getEntryResultSet(pql, null, true, pageSize, true);
   int totalSize = sr.getTotalSize();
   int maxPage = totalSize / pageSize + (totalSize % pageSize > 0 ? 1 : 0);
   int size = sr.toList().size();
   int pos = (maxPage - 1) * pageSize;
   int left = totalSize - pos;
   System.out.println(
       "maxPage:"
           + maxPage
           + " totalSize:"
           + totalSize
           + " pos:"
           + pos
           + " size:"
           + size
           + " left:"
           + left);
   System.out.println();
   boolean bl = sr.goToSet(pos);
   int lastSetSize = sr.toList().size();
   Assert.assertTrue(bl);
   Assert.assertTrue(left == lastSetSize);
 }
Example #3
0
  @SuppressWarnings("unchecked")
  @BeforeClass
  public static void loginPado() throws PadoLoginException, ParseException {
    // Security -- Comment out the following to disable security
    // System.setProperty("gemfireSecurityPropertyFile",
    // "etc/client/gfsecurity.properties");
    // System.setProperty("pado.security.aes.user.certificate",
    // "etc/user.cer");
    // System.setProperty("pado.security.enabled", "true");

    System.setProperty("gemfirePropertyFile", "etc/client/client.properties");
    Pado.connect("localhost:20000", true);
    pado = Pado.login("sys", "netcrest", "test1", "test123".toCharArray());
    ICatalog catalog = pado.getCatalog();
    temporalBiz = catalog.newInstance(ITemporalBiz.class);
    temporalBiz.setGridPath("temporal");
    temporalBiz.getBizContext().getGridContextClient().setGridIds("mygrid");
  }
Example #4
0
  @Test
  public void testScrollNextSet() throws ParseException {
    System.out.println("testScrollNextSet");
    System.out.println("=================");
    String pql = "account?";

    IScrollableResultSet<TemporalEntry<ITemporalKey<String>, ITemporalData<String>>> sr =
        temporalBiz.getEntryResultSet(pql, -1, -1, null, true, 100, true);
    printEntryScrollableResultSet_NextSet(sr);
  }