Tabnine Logo
Portfolio
Code IndexAdd Tabnine to your IDE (free)

How to use
Portfolio
in
org.apache.geode.cache.query.data

Best Java code snippets using org.apache.geode.cache.query.data.Portfolio (Showing top 20 results out of 315)

origin: apache/geode

public static Portfolio[] createPortfoliosAndPositions(int count) {
 Position.cnt = 0; // reset Portfolio counter
 Portfolio[] portfolios = new Portfolio[count];
 for (int i = 0; i < count; i++) {
  portfolios[i] = new Portfolio(i);
 }
 return portfolios;
}
origin: apache/geode

 @Override
 public Object execute() {
  Region region = PerfQuery.this.cache.getRegion("/portfolios");
  SelectResults results = new ResultsSet();
  for (Iterator itr = region.values().iterator(); itr.hasNext();) {
   Portfolio ptflo = (Portfolio) itr.next();
   if ("type1".equals(ptflo.getType())) {
    results.add(ptflo);
   }
  }
  return results;
 }
};
origin: apache/geode

private static void prepareDataForRegion(String regionPath) {
 InternalCache cache = ClusterStartupRule.getCache();
 Region dataRegion = cache.getRegion(regionPath);
 for (int j = 0; j < 10; j++) {
  dataRegion.put(new Integer(j), new Portfolio(j));
 }
}
origin: apache/geode

 @Override
 public Object execute() {
  Region region = PerfQuery.this.cache.getRegion("/portfolios");
  SelectResults results = new ResultsSet();
  for (Iterator itr = region.values().iterator(); itr.hasNext();) {
   Portfolio ptflo = (Portfolio) itr.next();
   if ("miss".equals(ptflo.getType())) {
    results.add(ptflo);
   }
  }
  return results;
 }
};
origin: apache/geode

/**
 * we are "indexed" on indexKey. Equality of portfolios is based on ID indexKeys are based on 0 ->
 * numEntries IDs are startID -> startID + numEntries
 *
 * @param numToCreate how many portfolios to create
 * @param startID the ID value to start incrementing from
 */
private Map<Integer, Portfolio> createPortfolioObjects(int numToCreate, int startID) {
 Map<Integer, Portfolio> portfoliosMap = new HashMap<>();
 IntStream.range(0, numToCreate).forEach(e -> {
  Portfolio p = new Portfolio(e + startID);
  p.indexKey = e;
  portfoliosMap.put(p.indexKey, p);
 });
 return portfoliosMap;
}
origin: apache/geode

@Override
@Test
public void testConvertibleGroupByQuery_refer_column() throws Exception {
 Region region = this.createRegion("portfolio", Portfolio.class);
 for (int i = 1; i < 200; ++i) {
  Portfolio pf = new Portfolio(i);
  pf.shortID = (short) ((short) i / 5);
  region.put("" + i, pf);
 }
 String queryStr = "select  p.shortID  from /portfolio p where p.ID >= 0 group by p.shortID ";
 QueryService qs = CacheUtils.getQueryService();
 Query query = qs.newQuery(queryStr);
 SelectResults<Short> results = (SelectResults<Short>) query.execute();
 Iterator<Short> iter = results.asList().iterator();
 int counter = 0;
 while (iter.hasNext()) {
  Short shortID = iter.next();
  assertEquals(counter++, shortID.intValue());
 }
 assertEquals(39, counter - 1);
}
origin: apache/geode

@Override
@Test
public void testConvertibleGroupByQuery_refer_column_alias_Bug520141() throws Exception {
 Region region = this.createRegion("portfolio", Portfolio.class);
 for (int i = 1; i < 200; ++i) {
  Portfolio pf = new Portfolio(i);
  pf.shortID = (short) ((short) i / 5);
  region.put("" + i, pf);
 }
 String queryStr =
   "select  p.shortID as short_id  from /portfolio p where p.ID >= 0 group by short_id ";
 QueryService qs = CacheUtils.getQueryService();
 Query query = qs.newQuery(queryStr);
 SelectResults<Struct> results = (SelectResults<Struct>) query.execute();
 Iterator<Struct> iter = results.asList().iterator();
 int counter = 0;
 while (iter.hasNext()) {
  Struct str = iter.next();
  assertEquals(counter++, ((Short) str.get("short_id")).intValue());
 }
 assertEquals(39, counter - 1);
}
origin: apache/geode

@Test
public void testOrderByWithColumnAlias_Bug52041_1() throws Exception {
 Region region = createRegion("portfolio", Portfolio.class);
 for (int i = 1; i < 200; ++i) {
  Portfolio pf = new Portfolio(i);
  pf.shortID = (short) ((short) i / 5);
  pf.status = "active";
  region.put("" + i, pf);
 }
 String queryStr =
   "select distinct p.status, p.shortID as short_id  from /portfolio p where p.ID >= 0 "
     + "order by short_id asc";
 QueryService qs = CacheUtils.getQueryService();
 Query query = qs.newQuery(queryStr);
 SelectResults<Struct> results = (SelectResults<Struct>) query.execute();
 Iterator<Struct> iter = results.asList().iterator();
 int counter = 0;
 while (iter.hasNext()) {
  Struct str = iter.next();
  assertEquals(counter, ((Short) str.get("short_id")).intValue());
  ++counter;
 }
 assertEquals(39, counter - 1);
 CompiledSelect cs = ((DefaultQuery) query).getSimpleSelect();
 List<CompiledSortCriterion> orderbyAtts = cs.getOrderByAttrs();
 assertEquals(orderbyAtts.get(0).getColumnIndex(), 1);
}
origin: apache/geode

private void warmUpIndexCreation() throws CacheException, QueryException {
 System.out.println("Populating Cache with 1000 Portfolios");
 if (this.region != null) {
  this.region.localDestroyRegion();
 }
 this.region = cache.createRegion("portfolios", this.regionAttributes);
 for (int i = 0; i < 1000; i++) {
  this.region.put(String.valueOf(i), new Portfolio(i));
 }
 System.out.println("Warming up index creation...");
 for (int i = 0; i < 20000; i++) {
  Index index = this.qs.createIndex("portfolios", IndexType.FUNCTIONAL, "type", "/portfolios");
  this.qs.removeIndex(index);
 }
}
origin: apache/geode

@Test
public void testOrderByWithColumnAlias_Bug52041_2() throws Exception {
 Region region = createRegion("portfolio", Portfolio.class);
 for (int i = 0; i < 200; ++i) {
  Portfolio pf = new Portfolio(i);
  pf.shortID = (short) ((short) i / 5);
  pf.status = "active";
  region.put("" + i, pf);
 }
 String queryStr =
   "select distinct p.ID as _id, p.shortID as short_id  from /portfolio p where p.ID >= 0 "
     + "order by short_id asc, p.ID desc";
 QueryService qs = CacheUtils.getQueryService();
 Query query = qs.newQuery(queryStr);
 SelectResults<Struct> results = (SelectResults<Struct>) query.execute();
 Iterator<Struct> iter = results.asList().iterator();
 int counter = 0;
 int k = 0;
 while (iter.hasNext()) {
  k = ((counter) / 5 + 1) * 5 - 1;
  Struct str = iter.next();
  assertEquals(counter / 5, ((Short) str.get("short_id")).intValue());
  assertEquals(k - (counter) % 5, ((Integer) str.get("_id")).intValue());
  ++counter;
 }
 CompiledSelect cs = ((DefaultQuery) query).getSimpleSelect();
 List<CompiledSortCriterion> orderbyAtts = cs.getOrderByAttrs();
 assertEquals(orderbyAtts.get(0).getColumnIndex(), 1);
 assertEquals(orderbyAtts.get(1).getColumnIndex(), 0);
}
origin: apache/geode

private void populate(int numPortfolios, boolean indexed) throws CacheException, QueryException {
 System.out.println("Populating Cache with " + numPortfolios + " Portfolios");
 if (this.region != null) {
  this.region.localDestroyRegion();
 }
 this.region = cache.createRegion("portfolios", this.regionAttributes);
 for (int i = 0; i < numPortfolios; i++) {
  this.region.put(String.valueOf(i), new Portfolio(i));
 }
 if (indexed) {
  System.out.println("Creating index...");
  long startNanos = NanoTimer.getTime();
  this.qs.createIndex("portfolios", IndexType.FUNCTIONAL, "type", "/portfolios");
  float createTime = (NanoTimer.getTime() - startNanos) / 1e6f;
  System.out.println("Index created in " + createTime + " ms.");
  this.results[INDEX_CREATE].add(createTime);
 }
}
origin: apache/geode

Region region = this.createRegion("portfolio", Portfolio.class);
for (int i = 1; i < 600; ++i) {
 Portfolio pf = new Portfolio(i);
 if (pf.status.equals("active")) {
  pf.shortID = (short) ((short) i % 5);
origin: apache/geode

@Test
public void testIndexWhenObjectNotInSetWhenPopulated() {
 int numEntries = 10;
 this.setupHashIndexSet(numEntries);
 assertEquals(-1, his.index(new Portfolio(numEntries + 1)));
}
origin: apache/geode

r1.put(i + "", new Portfolio(i));
origin: apache/geode

r1.put(i + "", new Portfolio(i));
origin: apache/geode

r1.put(i + "", new Portfolio(i));
origin: apache/geode

r1.put(i + "", new Portfolio(i));
origin: apache/geode

@Test
public void testHashIndexContainsAllShouldReturnFalse() throws Exception {
 int numEntries = 100;
 setupHashIndexSet(numEntries);
 assertEquals(numEntries, his.size());
 portfolioSet.add(new Portfolio(numEntries + 1));
 assertFalse(his.containsAll(portfolioSet));
}
origin: apache/geode

Portfolio pf = new Portfolio(i);
pf.shortID = (short) ((short) i / 5);
r1.put("" + i, pf);
origin: apache/geode

Portfolio pf = new Portfolio(i);
pf.shortID = (short) ((short) i / 5);
r1.put("" + i, pf);
org.apache.geode.cache.query.dataPortfolio

Javadoc

THIS FILE IS ENCODED IN UTF-8 IN ORDER TO TEST UNICODE IN FIELD NAMES. THE ENCODING MUST BE SPECIFIED AS UTF-8 WHEN COMPILED

Most used methods

  • <init>
  • getType
    Getter for property type.S

Popular in Java

  • Reading from database using SQL prepared statement
  • startActivity (Activity)
  • setRequestProperty (URLConnection)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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