/**
  * Construct with invalid System property for JGAPFactory set.
  *
  * @author Klaus Meffert
  * @since 2.6
  */
 public void testConstruct_1() {
   System.setProperty(Configuration.PROPERTY_JGAPFACTORY_CLASS, "org.jgap.myFactoryTest");
   try {
     new Configuration();
     fail();
   } catch (RuntimeException rex) {; // this is OK
   }
 }
  /**
   * @return AOP test suite.
   * @throws Exception If failed.
   */
  public static TestSuite suite() throws Exception {
    TestSuite suite = new TestSuite("Gridgain AOP Test Suite");

    // Test configuration.
    suite.addTest(new TestSuite(GridBasicAopSelfTest.class));

    suite.addTest(new TestSuite(GridSpringAopSelfTest.class));
    suite.addTest(new TestSuite(GridNonSpringAopSelfTest.class));
    suite.addTest(new TestSuite(GridifySetToXXXSpringAopSelfTest.class));
    suite.addTest(new TestSuite(GridifySetToXXXNonSpringAopSelfTest.class));
    suite.addTest(new TestSuite(GridExternalNonSpringAopSelfTest.class));

    // Examples
    System.setProperty(
        GG_OVERRIDE_MCAST_GRP, GridTestUtils.getNextMulticastGroup(GridAopSelfTestSuite.class));

    return suite;
  }
  /**
   * Starts Grid instance. Note that if grid is already started, then it will be looked up and
   * returned from this method.
   *
   * @return Started grid.
   */
  private Grid startGrid() {
    Properties props = System.getProperties();

    gridName = props.getProperty(GRIDGAIN_NAME.name());

    if (!props.containsKey(GRIDGAIN_NAME.name()) || G.state(gridName) != GridFactoryState.STARTED) {
      selfStarted = true;

      // Set class loader for the spring.
      ClassLoader curCl = Thread.currentThread().getContextClassLoader();

      // Add no-op logger to remove no-appender warning.
      Appender app = new NullAppender();

      Logger.getRootLogger().addAppender(app);

      try {
        Thread.currentThread().setContextClassLoader(getClass().getClassLoader());

        Grid grid = G.start(cfgPath);

        gridName = grid.name();

        System.setProperty(GRIDGAIN_NAME.name(), grid.name());

        return grid;
      } catch (GridException e) {
        throw new GridRuntimeException("Failed to start grid: " + cfgPath, e);
      } finally {
        Logger.getRootLogger().removeAppender(app);

        Thread.currentThread().setContextClassLoader(curCl);
      }
    }

    return G.grid(gridName);
  }
 static {
   System.setProperty(
       "org.openide.util.Lookup", "org.openide.filesystems.MIMESupportResolversTest$Lkp");
   Logger.getLogger("").addHandler(new ErrMgr());
   Logger.getLogger("").setLevel(Level.ALL);
 }
 static {
   System.setProperty(
       "org.openide.util.Lookup", GlobalSharabilityQueryImplTest.TestLookup.class.getName());
 }
 /**
  * Construct with no System property for JGAPFactory set.
  *
  * @author Klaus Meffert
  * @since 3.0
  */
 public void testConstruct_2() {
   System.setProperty(Configuration.PROPERTY_JGAPFACTORY_CLASS, "");
   Configuration conf = new Configuration();
   assertEquals(JGAPFactory.class, conf.getJGAPFactory().getClass());
 }