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);
}
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);
}
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);
}
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();
}
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);
}
Aggregations