示例#1
0
  /** @throws Exception If failed. */
  public void testLocalIfAffinityMapperIsWrongClass() throws Exception {
    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    for (GridCacheConfiguration cc : g1Cfg.getCacheConfiguration())
      cc.setAffinityMapper(new GridCacheDefaultAffinityKeyMapper());

    checkGridStartFails(
        g1Cfg, "Invalid GGFS data cache configuration (key affinity mapper class should be", true);
  }
示例#2
0
  /** @throws Exception If failed. */
  public void testLocalIfNoMetadataCacheIsConfigured() throws Exception {
    GridCacheConfiguration cc = defaultCacheConfiguration();

    cc.setQueryIndexEnabled(false);
    cc.setName(dataCache1Name);

    g1Cfg.setCacheConfiguration(cc);

    checkGridStartFails(g1Cfg, "Metadata cache is not configured locally for GGFS", true);
  }
示例#3
0
  /** @throws Exception If failed. */
  public void testLocalIfBackupsEnabled() throws Exception {
    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    for (GridCacheConfiguration cc : g1Cfg.getCacheConfiguration()) {
      cc.setCacheMode(PARTITIONED);
      cc.setBackups(1);
    }

    checkGridStartFails(g1Cfg, "GGFS data cache cannot be used with backups", true);
  }
示例#4
0
  /** @throws Exception If failed. */
  public void testLocalIfOffheapIsEnabledAndMaxSpaceSizeIsGreater() throws Exception {
    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    for (GridCacheConfiguration cc : g1Cfg.getCacheConfiguration()) cc.setOffHeapMaxMemory(1000000);

    g1GgfsCfg2.setMaxSpaceSize(999999999999999999L);

    checkGridStartFails(
        g1Cfg,
        "Maximum GGFS space size cannot be greater than size of available heap memory and offheap storage",
        true);
  }
示例#5
0
  /**
   * @param cacheNames 2 Optional caches names.
   * @return 2 preconfigured meta caches.
   */
  private GridCacheConfiguration[] metaCaches(String... cacheNames) {
    assertTrue(ArrayUtils.isEmpty(cacheNames) || cacheNames.length == 2);

    if (ArrayUtils.isEmpty(cacheNames)) cacheNames = new String[] {metaCache1Name, metaCache2Name};

    GridCacheConfiguration[] res = new GridCacheConfiguration[cacheNames.length];

    for (int i = 0; i < cacheNames.length; i++) {
      GridCacheConfiguration metaCache = defaultCacheConfiguration();

      metaCache.setName(cacheNames[i]);
      metaCache.setAtomicityMode(TRANSACTIONAL);
      metaCache.setQueryIndexEnabled(false);

      res[i] = metaCache;
    }

    return res;
  }
示例#6
0
  /**
   * @param grpSize Group size to use in {@link GridGgfsGroupDataBlocksKeyMapper}.
   * @param cacheNames 2 Optional caches names.
   * @return 2 preconfigured data caches.
   */
  private GridCacheConfiguration[] dataCaches(int grpSize, String... cacheNames) {
    assertTrue(ArrayUtils.isEmpty(cacheNames) || cacheNames.length == 2);

    if (ArrayUtils.isEmpty(cacheNames)) cacheNames = new String[] {dataCache1Name, dataCache2Name};

    GridCacheConfiguration[] res = new GridCacheConfiguration[cacheNames.length];

    for (int i = 0; i < cacheNames.length; i++) {
      GridCacheConfiguration dataCache = defaultCacheConfiguration();

      dataCache.setName(cacheNames[i]);
      dataCache.setAffinityMapper(new GridGgfsGroupDataBlocksKeyMapper(grpSize));
      dataCache.setAtomicityMode(TRANSACTIONAL);
      dataCache.setQueryIndexEnabled(false);

      res[i] = dataCache;
    }

    return res;
  }