Search in sources :

Example 91 with BeforeClass

use of org.junit.BeforeClass in project flink by apache.

the class WindowCheckpointingITCase method startTestCluster.

@BeforeClass
public static void startTestCluster() {
    Configuration config = new Configuration();
    config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
    config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, PARALLELISM / 2);
    config.setInteger(ConfigConstants.TASK_MANAGER_MEMORY_SIZE_KEY, 48);
    cluster = new LocalFlinkMiniCluster(config, false);
    cluster.start();
}
Also used : Configuration(org.apache.flink.configuration.Configuration) LocalFlinkMiniCluster(org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster) BeforeClass(org.junit.BeforeClass)

Example 92 with BeforeClass

use of org.junit.BeforeClass in project flink by apache.

the class ClassLoaderITCase method setUp.

@BeforeClass
public static void setUp() throws Exception {
    FOLDER.create();
    Configuration config = new Configuration();
    config.setInteger(ConfigConstants.LOCAL_NUMBER_TASK_MANAGER, 2);
    config.setInteger(ConfigConstants.TASK_MANAGER_NUM_TASK_SLOTS, 2);
    parallelism = 4;
    // we need to use the "filesystem" state backend to ensure FLINK-2543 is not happening again.
    config.setString(CoreOptions.STATE_BACKEND, "filesystem");
    config.setString(FsStateBackendFactory.CHECKPOINT_DIRECTORY_URI_CONF_KEY, FOLDER.newFolder().getAbsoluteFile().toURI().toString());
    // Savepoint path
    config.setString(ConfigConstants.SAVEPOINT_DIRECTORY_KEY, FOLDER.newFolder().getAbsoluteFile().toURI().toString());
    testCluster = new TestingCluster(config, false);
    testCluster.start();
}
Also used : TestingCluster(org.apache.flink.runtime.testingUtils.TestingCluster) Configuration(org.apache.flink.configuration.Configuration) BeforeClass(org.junit.BeforeClass)

Example 93 with BeforeClass

use of org.junit.BeforeClass in project flink by apache.

the class YARNHighAvailabilityITCase method setup.

@BeforeClass
public static void setup() {
    actorSystem = AkkaUtils.createDefaultActorSystem();
    try {
        zkServer = new TestingServer();
        zkServer.start();
    } catch (Exception e) {
        e.printStackTrace();
        Assert.fail("Could not start ZooKeeper testing cluster.");
    }
    yarnConfiguration.set(YarnTestBase.TEST_CLUSTER_NAME_KEY, "flink-yarn-tests-ha");
    yarnConfiguration.set(YarnConfiguration.RM_AM_MAX_ATTEMPTS, "" + numberApplicationAttempts);
    startYARNWithConfig(yarnConfiguration);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) BeforeClass(org.junit.BeforeClass)

Example 94 with BeforeClass

use of org.junit.BeforeClass in project flink by apache.

the class YARNSessionFIFOSecuredITCase method setup.

@BeforeClass
public static void setup() {
    LOG.info("starting secure cluster environment for testing");
    yarnConfiguration.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class, ResourceScheduler.class);
    yarnConfiguration.setInt(YarnConfiguration.NM_PMEM_MB, 768);
    yarnConfiguration.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 512);
    yarnConfiguration.set(YarnTestBase.TEST_CLUSTER_NAME_KEY, "flink-yarn-tests-fifo-secured");
    SecureTestEnvironment.prepare(tmp);
    populateYarnSecureConfigurations(yarnConfiguration, SecureTestEnvironment.getHadoopServicePrincipal(), SecureTestEnvironment.getTestKeytab());
    Configuration flinkConfig = new Configuration();
    flinkConfig.setString(SecurityOptions.KERBEROS_LOGIN_KEYTAB, SecureTestEnvironment.getTestKeytab());
    flinkConfig.setString(SecurityOptions.KERBEROS_LOGIN_PRINCIPAL, SecureTestEnvironment.getHadoopServicePrincipal());
    SecurityUtils.SecurityConfiguration ctx = new SecurityUtils.SecurityConfiguration(flinkConfig, yarnConfiguration);
    try {
        TestingSecurityContext.install(ctx, SecureTestEnvironment.getClientSecurityConfigurationMap());
        SecurityUtils.getInstalledContext().runSecured(new Callable<Object>() {

            @Override
            public Integer call() {
                startYARNSecureMode(yarnConfiguration, SecureTestEnvironment.getHadoopServicePrincipal(), SecureTestEnvironment.getTestKeytab());
                return null;
            }
        });
    } catch (Exception e) {
        throw new RuntimeException("Exception occurred while setting up secure test context. Reason: {}", e);
    }
}
Also used : Configuration(org.apache.flink.configuration.Configuration) YarnConfiguration(org.apache.hadoop.yarn.conf.YarnConfiguration) SecurityUtils(org.apache.flink.runtime.security.SecurityUtils) BeforeClass(org.junit.BeforeClass)

Example 95 with BeforeClass

use of org.junit.BeforeClass in project flink by apache.

the class CliFrontendYarnAddressConfigurationTest method disableStdOutErr.

@BeforeClass
public static void disableStdOutErr() {
    class NullPrint extends OutputStream {

        @Override
        public void write(int b) {
        }
    }
    PrintStream nullPrinter = new PrintStream(new NullPrint());
    System.setOut(nullPrinter);
    System.setErr(nullPrinter);
    // Unset FLINK_CONF_DIR, as this is a precondition for this test to work properly
    Map<String, String> map = new HashMap<>(System.getenv());
    map.remove(ConfigConstants.ENV_FLINK_CONF_DIR);
    TestBaseUtils.setEnv(map);
}
Also used : PrintStream(java.io.PrintStream) HashMap(java.util.HashMap) OutputStream(java.io.OutputStream) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)2813 File (java.io.File)388 Configuration (org.apache.hadoop.conf.Configuration)287 IOException (java.io.IOException)128 Connection (java.sql.Connection)126 Properties (java.util.Properties)108 Reader (java.io.Reader)99 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)98 Provisioning (com.zimbra.cs.account.Provisioning)93 ScriptRunner (org.apache.ibatis.jdbc.ScriptRunner)91 HiveConf (org.apache.hadoop.hive.conf.HiveConf)86 MockProvisioning (com.zimbra.cs.account.MockProvisioning)77 Path (org.apache.hadoop.fs.Path)75 URI (java.net.URI)73 HashMap (java.util.HashMap)70 URL (java.net.URL)63 SqlSession (org.apache.ibatis.session.SqlSession)62 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)61 Injector (com.google.inject.Injector)57 CConfiguration (co.cask.cdap.common.conf.CConfiguration)56