Search in sources :

Example 91 with BeforeClass

use of org.testng.annotations.BeforeClass in project incubator-gobblin by apache.

the class JobExecutionInfoServerTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    testMetastoreDatabase = TestMetastoreDatabaseFactory.get();
    Properties properties = new Properties();
    properties.setProperty(ConfigurationKeys.JOB_HISTORY_STORE_URL_KEY, testMetastoreDatabase.getJdbcUrl());
    int randomPort = chooseRandomPort();
    properties.setProperty(ConfigurationKeys.REST_SERVER_PORT_KEY, Integer.toString(randomPort));
    Injector injector = Guice.createInjector(new MetaStoreModule(properties));
    this.jobHistoryStore = injector.getInstance(JobHistoryStore.class);
    this.client = new JobExecutionInfoClient(String.format("http://%s:%s/", "localhost", randomPort));
    this.server = new JobExecutionInfoServer(properties);
    this.server.startUp();
    this.expected1 = createJobExecutionInfo(1);
    this.expected2 = createJobExecutionInfo(2);
    this.jobHistoryStore.put(this.expected1);
    this.jobHistoryStore.put(this.expected2);
}
Also used : JobHistoryStore(org.apache.gobblin.metastore.JobHistoryStore) Injector(com.google.inject.Injector) MetaStoreModule(org.apache.gobblin.metastore.MetaStoreModule) Properties(java.util.Properties) BeforeClass(org.testng.annotations.BeforeClass)

Example 92 with BeforeClass

use of org.testng.annotations.BeforeClass in project incubator-gobblin by apache.

the class FlowStatusTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    ConfigBuilder configBuilder = ConfigBuilder.create();
    JobStatusRetriever jobStatusRetriever = new TestJobStatusRetriever();
    final FlowStatusGenerator flowStatusGenerator = FlowStatusGenerator.builder().jobStatusRetriever(jobStatusRetriever).build();
    Injector injector = Guice.createInjector(new Module() {

        @Override
        public void configure(Binder binder) {
            binder.bind(FlowStatusGenerator.class).annotatedWith(Names.named(FlowStatusResource.FLOW_STATUS_GENERATOR_INJECT_NAME)).toInstance(flowStatusGenerator);
        }
    });
    _server = EmbeddedRestliServer.builder().resources(Lists.<Class<? extends BaseResource>>newArrayList(FlowStatusResource.class)).injector(injector).build();
    _server.startAsync();
    _server.awaitRunning();
    _client = new FlowStatusClient(String.format("http://localhost:%s/", _server.getPort()));
    messageJoiner = Joiner.on(FlowStatusResource.MESSAGE_SEPARATOR);
}
Also used : Binder(com.google.inject.Binder) Injector(com.google.inject.Injector) BaseResource(com.linkedin.restli.server.resources.BaseResource) ConfigBuilder(org.apache.gobblin.config.ConfigBuilder) AfterClass(org.testng.annotations.AfterClass) BeforeClass(org.testng.annotations.BeforeClass) Module(com.google.inject.Module) FlowStatusGenerator(org.apache.gobblin.service.monitoring.FlowStatusGenerator) JobStatusRetriever(org.apache.gobblin.service.monitoring.JobStatusRetriever) BeforeClass(org.testng.annotations.BeforeClass)

Example 93 with BeforeClass

use of org.testng.annotations.BeforeClass in project incubator-gobblin by apache.

the class GobblinAWSClusterLauncherTest method setUp.

@BeforeClass
public void setUp() throws Exception {
    // Mock AWS SDK calls
    MockitoAnnotations.initMocks(this);
    PowerMockito.whenNew(AWSSdkClient.class).withAnyArguments().thenReturn(awsSdkClient);
    Mockito.doNothing().when(awsSdkClient).createSecurityGroup(Mockito.anyString(), Mockito.anyString());
    Mockito.doReturn(Lists.<AvailabilityZone>newArrayList(availabilityZone)).when(awsSdkClient).getAvailabilityZones();
    Mockito.doReturn("dummy").when(awsSdkClient).createKeyValuePair(Mockito.anyString());
    Mockito.doReturn(Lists.<AutoScalingGroup>newArrayList(masterASG, workerASG)).when(awsSdkClient).getAutoScalingGroupsWithTag(Mockito.any(Tag.class));
    Mockito.doReturn(Lists.<Instance>newArrayList(instance)).when(awsSdkClient).getInstancesForGroup(Mockito.anyString(), Mockito.anyString());
    Mockito.doReturn(Lists.<S3ObjectSummary>newArrayList()).when(awsSdkClient).listS3Bucket(Mockito.anyString(), Mockito.anyString());
    Mockito.doNothing().when(awsSdkClient).addPermissionsToSecurityGroup(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(Integer.class), Mockito.any(Integer.class));
    Mockito.doNothing().when(awsSdkClient).createAutoScalingGroup(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(Integer.class), Mockito.any(Integer.class), Mockito.any(Integer.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(List.class));
    Mockito.doNothing().when(awsSdkClient).createLaunchConfig(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(Optional.class), Mockito.any(String.class));
    Mockito.doNothing().when(awsSdkClient).deleteAutoScalingGroup(Mockito.any(String.class), Mockito.any(boolean.class));
    Mockito.doNothing().when(awsSdkClient).deleteLaunchConfiguration(Mockito.any(String.class));
    Mockito.doNothing().when(awsSdkClient).addPermissionsToSecurityGroup(Mockito.any(String.class), Mockito.any(String.class), Mockito.any(String.class), Mockito.any(Integer.class), Mockito.any(Integer.class));
    // Local test Zookeeper
    final TestingServer testingZKServer = this.closer.register(new TestingServer(-1));
    LOG.info("Testing ZK Server listening on: " + testingZKServer.getConnectString());
    this.curatorFramework = TestHelper.createZkClient(testingZKServer, this.closer);
    // Load configuration
    final URL url = GobblinAWSClusterLauncherTest.class.getClassLoader().getResource(GobblinAWSClusterLauncherTest.class.getSimpleName() + ".conf");
    Assert.assertNotNull(url, "Could not find resource " + url);
    this.config = ConfigFactory.parseURL(url).withValue("gobblin.cluster.zk.connection.string", ConfigValueFactory.fromAnyRef(testingZKServer.getConnectString())).resolve();
    this.helixClusterName = this.config.getString(GobblinClusterConfigurationKeys.HELIX_CLUSTER_NAME_KEY);
    final String zkConnectionString = this.config.getString(GobblinClusterConfigurationKeys.ZK_CONNECTION_STRING_KEY);
    this.helixManager = HelixManagerFactory.getZKHelixManager(this.config.getString(GobblinClusterConfigurationKeys.HELIX_CLUSTER_NAME_KEY), TestHelper.TEST_HELIX_INSTANCE_NAME, InstanceType.CONTROLLER, zkConnectionString);
    // Gobblin AWS Cluster Launcher to test
    this.gobblinAwsClusterLauncher = new GobblinAWSClusterLauncher(this.config);
}
Also used : TestingServer(org.apache.curator.test.TestingServer) Optional(com.google.common.base.Optional) List(java.util.List) Tag(com.amazonaws.services.autoscaling.model.Tag) URL(java.net.URL) BeforeClass(org.testng.annotations.BeforeClass)

Example 94 with BeforeClass

use of org.testng.annotations.BeforeClass in project incubator-gobblin by apache.

the class MRCompactorAvroKeyDedupJobRunnerTest method setUp.

@BeforeClass
public void setUp() throws IOException {
    State state = new State();
    state.setProp(ConfigurationKeys.JOB_NAME_KEY, "MRCompactorAvroKeyDedupJobRunnerTest");
    state.setProp(MRCompactor.COMPACTION_SHOULD_DEDUPLICATE, "true");
    Dataset.Builder datasetBuilder = (new Dataset.Builder()).withInputPath(new Path("/tmp"));
    Dataset dataset = datasetBuilder.build();
    dataset.setJobProps(state);
    this.runner = new MRCompactorAvroKeyDedupJobRunner(dataset, FileSystem.get(new Configuration()));
    this.job = Job.getInstance();
}
Also used : Path(org.apache.hadoop.fs.Path) Configuration(org.apache.hadoop.conf.Configuration) State(org.apache.gobblin.configuration.State) Dataset(org.apache.gobblin.compaction.dataset.Dataset) BeforeClass(org.testng.annotations.BeforeClass)

Example 95 with BeforeClass

use of org.testng.annotations.BeforeClass in project incubator-gobblin by apache.

the class TestConfigClientUtils method setup.

@BeforeClass
public void setup() throws Exception {
    mockConfigStore = mock(ConfigStore.class, Mockito.RETURNS_SMART_NULLS);
    URI configStorURI = new URI("etl-hdfs://eat1-nertznn01.grid.linkedin.com:9000/user/mitu/HdfsBasedConfigTest");
    when(mockConfigStore.getCurrentVersion()).thenReturn(version);
    when(mockConfigStore.getStoreURI()).thenReturn(configStorURI);
}
Also used : ConfigStore(org.apache.gobblin.config.store.api.ConfigStore) URI(java.net.URI) BeforeClass(org.testng.annotations.BeforeClass)

Aggregations

BeforeClass (org.testng.annotations.BeforeClass)1186 Series (com.axibase.tsd.api.model.series.Series)178 File (java.io.File)157 ArrayList (java.util.ArrayList)78 HashMap (java.util.HashMap)43 ClusterControllerManager (org.apache.helix.integration.manager.ClusterControllerManager)37 Injector (com.google.inject.Injector)36 Properties (java.util.Properties)35 Path (org.apache.hadoop.fs.Path)33 ClusterSetup (org.apache.helix.tools.ClusterSetup)33 Configuration (org.apache.hadoop.conf.Configuration)31 BigDecimal (java.math.BigDecimal)29 URL (java.net.URL)28 MockParticipantManager (org.apache.helix.integration.manager.MockParticipantManager)27 Date (java.util.Date)26 Server (org.eclipse.jetty.server.Server)25 ServerConnector (org.eclipse.jetty.server.ServerConnector)25 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)23 IOException (java.io.IOException)23 Path (java.nio.file.Path)23