示例#1
0
  /** @throws Exception If failed. */
  public void testRemoteIfDataCacheNameEquals() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1);
    GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2);

    g2GgfsCfg1.setName("g2GgfsCfg1");
    g2GgfsCfg2.setName("g2GgfsCfg2");

    g2GgfsCfg1.setMetaCacheName("g2MetaCache1");
    g2GgfsCfg2.setMetaCacheName("g2MetaCache2");

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(
            dataCaches(1024),
            metaCaches("g2MetaCache1", "g2MetaCache2"),
            GridCacheConfiguration.class));

    g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2);

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg, "Data cache names should be different for different GGFS instances", false);
  }
示例#2
0
  /** @throws Exception If failed. */
  @SuppressWarnings("NullableProblems")
  public void testLocalNullGgfsNameIsSupported() throws Exception {
    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    g1GgfsCfg1.setName(null);

    assertFalse(G.start(g1Cfg).nodes().isEmpty());
  }
示例#3
0
  /** @throws Exception If failed. */
  public void testRemoteIfAffinityMapperGroupSizeDiffers() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(dataCaches(4021), metaCaches(), GridCacheConfiguration.class));

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg,
        "Affinity mapper group size should be the same on all nodes in grid for GGFS",
        false);
  }
示例#4
0
  /** @throws Exception If failed. */
  public void testRemoteIfDataBlockSizeDiffers() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1);

    g2GgfsCfg1.setBlockSize(g2GgfsCfg1.getBlockSize() + 100);

    g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g1GgfsCfg2);

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg, "Data block size should be same on all nodes in grid for GGFS", false);
  }
示例#5
0
  /**
   * Checks that the given grid configuration will lead to {@link GridException} upon grid startup.
   *
   * @param cfg Grid configuration to check.
   * @param excMsgSnippet Root cause (assertion) exception message snippet.
   * @param testLoc {@code True} if checking is done for "testLocal" tests.
   */
  private void checkGridStartFails(
      GridConfiguration cfg, CharSequence excMsgSnippet, boolean testLoc) {
    assertNotNull(cfg);
    assertNotNull(excMsgSnippet);

    try {
      G.start(cfg);

      fail("No exception has been thrown.");
    } catch (GridException e) {
      if (testLoc) {
        if ("Failed to start processor: GridProcessorAdapter []".equals(e.getMessage())
            && e.getCause().getMessage().contains(excMsgSnippet)) return; // Expected exception.
      } else if (e.getMessage().contains(excMsgSnippet)) return; // Expected exception.

      error("Caught unexpected exception.", e);

      fail();
    }
  }
示例#6
0
  /** @throws Exception If failed. */
  public void testRemoteIfPathModeDiffers() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1);
    GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2);

    g2GgfsCfg1.setPathModes(ImmutableMap.of("/somePath", DUAL_SYNC));
    g2GgfsCfg2.setPathModes(ImmutableMap.of("/somePath", DUAL_SYNC));

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2);

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg, "Path modes should be the same on all nodes in grid for GGFS", false);
  }
示例#7
0
  /** @throws Exception If failed. */
  public void testRemoteIfDefaultModeDiffers() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1);
    GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2);

    g1GgfsCfg1.setDefaultMode(DUAL_ASYNC);
    g1GgfsCfg2.setDefaultMode(DUAL_ASYNC);

    g2GgfsCfg1.setDefaultMode(DUAL_SYNC);
    g2GgfsCfg2.setDefaultMode(DUAL_SYNC);

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));

    g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2);

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg, "Default mode should be the same on all nodes in grid for GGFS", false);
  }
示例#8
0
  /** @throws Exception If failed. */
  public void testRemoteIfMetaCacheNameDiffers() throws Exception {
    GridConfiguration g2Cfg = getConfiguration("g2");

    GridGgfsConfiguration g2GgfsCfg1 = new GridGgfsConfiguration(g1GgfsCfg1);
    GridGgfsConfiguration g2GgfsCfg2 = new GridGgfsConfiguration(g1GgfsCfg2);

    g2GgfsCfg1.setMetaCacheName("g2MetaCache1");
    g2GgfsCfg2.setMetaCacheName("g2MetaCache2");

    g1Cfg.setCacheConfiguration(
        concat(dataCaches(1024), metaCaches(), GridCacheConfiguration.class));
    g2Cfg.setCacheConfiguration(
        concat(
            dataCaches(1024),
            metaCaches("g2MetaCache1", "g2MetaCache2"),
            GridCacheConfiguration.class));

    g2Cfg.setGgfsConfiguration(g2GgfsCfg1, g2GgfsCfg2);

    G.start(g1Cfg);

    checkGridStartFails(
        g2Cfg, "Meta cache name should be the same on all nodes in grid for GGFS", false);
  }