mirror of
https://github.com/apache/sqoop.git
synced 2025-05-05 06:29:49 +08:00
SQOOP-1950. Sqoop2: Use TestNG
(Abraham Elmahrek via Hari Shreedharan)
This commit is contained in:
parent
f073cf6938
commit
471e534ef6
@ -33,8 +33,8 @@ limitations under the License.
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.client;
|
package org.apache.sqoop.client;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@ -45,15 +45,15 @@
|
|||||||
import org.apache.sqoop.model.MLinkConfig;
|
import org.apache.sqoop.model.MLinkConfig;
|
||||||
import org.apache.sqoop.model.MToConfig;
|
import org.apache.sqoop.model.MToConfig;
|
||||||
import org.apache.sqoop.utils.MapResourceBundle;
|
import org.apache.sqoop.utils.MapResourceBundle;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestSqoopClient {
|
public class TestSqoopClient {
|
||||||
|
|
||||||
SqoopResourceRequests resourceRequests;
|
SqoopResourceRequests resourceRequests;
|
||||||
SqoopClient client;
|
SqoopClient client;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
resourceRequests = mock(SqoopResourceRequests.class);
|
resourceRequests = mock(SqoopResourceRequests.class);
|
||||||
client = new SqoopClient("my-cool-server");
|
client = new SqoopClient("my-cool-server");
|
||||||
@ -199,7 +199,7 @@ public void testGetConnectorOneByOne() {
|
|||||||
/**
|
/**
|
||||||
* Link for non-existing connector can't be created.
|
* Link for non-existing connector can't be created.
|
||||||
*/
|
*/
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testCreateLink() {
|
public void testCreateLink() {
|
||||||
when(resourceRequests.readConnector(null)).thenReturn(connectorBean(connector(1)));
|
when(resourceRequests.readConnector(null)).thenReturn(connectorBean(connector(1)));
|
||||||
client.createLink("non existing connector");
|
client.createLink("non existing connector");
|
||||||
|
@ -36,8 +36,8 @@ limitations under the License.
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database provider related asserts.
|
* Database provider related asserts.
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
/**
|
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance
|
|
||||||
* with the License. You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.apache.sqoop.common.test.categories;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Slow tests interface for JUnit categories.
|
|
||||||
* This should be used if your unit tests rely on
|
|
||||||
* some piece of infrastructure that takes time to start.
|
|
||||||
* For example, using a MySQL database takes time to setup
|
|
||||||
* and start because it is in a separate process.
|
|
||||||
*/
|
|
||||||
public interface SlowTests {}
|
|
@ -41,8 +41,8 @@ limitations under the License.
|
|||||||
<artifactId>json-simple</artifactId>
|
<artifactId>json-simple</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.common.MapContext
|
* Test class for org.apache.sqoop.common.MapContext
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.common;
|
package org.apache.sqoop.common;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.common.SqoopResponseCode
|
* Test class for org.apache.sqoop.common.SqoopResponseCode
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.common;
|
package org.apache.sqoop.common;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestSupportedDirections {
|
public class TestSupportedDirections {
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.common;
|
package org.apache.sqoop.common;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestVersionInfo {
|
public class TestVersionInfo {
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -30,7 +30,7 @@
|
|||||||
import org.apache.sqoop.json.util.ConfigTestUtil;
|
import org.apache.sqoop.json.util.ConfigTestUtil;
|
||||||
import org.apache.sqoop.model.MConnector;
|
import org.apache.sqoop.model.MConnector;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestConnectorBean {
|
public class TestConnectorBean {
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -30,7 +30,7 @@
|
|||||||
import org.apache.sqoop.json.util.ConfigTestUtil;
|
import org.apache.sqoop.json.util.ConfigTestUtil;
|
||||||
import org.apache.sqoop.model.MConnector;
|
import org.apache.sqoop.model.MConnector;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestConnectorsBean {
|
public class TestConnectorsBean {
|
||||||
|
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import org.apache.sqoop.json.util.ConfigTestUtil;
|
import org.apache.sqoop.json.util.ConfigTestUtil;
|
||||||
import org.apache.sqoop.model.MDriver;
|
import org.apache.sqoop.model.MDriver;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -19,12 +19,12 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ -36,12 +36,12 @@ public void testString() {
|
|||||||
assertEquals((long)3, object.get("id"));
|
assertEquals((long)3, object.get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testStringInvalid() {
|
public void testStringInvalid() {
|
||||||
JSONUtils.parse("{");
|
JSONUtils.parse("{");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test(expectedExceptions = NullPointerException.class)
|
||||||
public void testStringNull() {
|
public void testStringNull() {
|
||||||
JSONUtils.parse((String)null);
|
JSONUtils.parse((String)null);
|
||||||
}
|
}
|
||||||
@ -52,12 +52,12 @@ public void testReader() {
|
|||||||
assertEquals((long)3, object.get("id"));
|
assertEquals((long)3, object.get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testReaderInvalid() {
|
public void testReaderInvalid() {
|
||||||
JSONUtils.parse(new StringReader("{"));
|
JSONUtils.parse(new StringReader("{"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = NullPointerException.class)
|
@Test(expectedExceptions = NullPointerException.class)
|
||||||
public void testReaderNull() {
|
public void testReaderNull() {
|
||||||
JSONUtils.parse((Reader)null);
|
JSONUtils.parse((Reader)null);
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -27,7 +27,7 @@
|
|||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestJobBean {
|
public class TestJobBean {
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -29,7 +29,7 @@
|
|||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.json.simple.parser.ParseException;
|
import org.json.simple.parser.ParseException;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestJobsBean {
|
public class TestJobsBean {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -29,7 +29,7 @@
|
|||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestLinkBean {
|
public class TestLinkBean {
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json;
|
package org.apache.sqoop.json;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -30,7 +30,7 @@
|
|||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestLinksBean {
|
public class TestLinksBean {
|
||||||
|
|
||||||
|
@ -27,14 +27,14 @@
|
|||||||
import org.apache.sqoop.submission.counter.CounterGroup;
|
import org.apache.sqoop.submission.counter.CounterGroup;
|
||||||
import org.apache.sqoop.submission.counter.Counters;
|
import org.apache.sqoop.submission.counter.Counters;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
// NOTE: This tests both the submission and submissions list bean
|
// NOTE: This tests both the submission and submissions list bean
|
||||||
public class TestSubmissionBean {
|
public class TestSubmissionBean {
|
||||||
|
@ -20,11 +20,11 @@
|
|||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.apache.sqoop.json.util.SerializationError;
|
import org.apache.sqoop.json.util.SerializationError;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -21,16 +21,16 @@
|
|||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.apache.sqoop.validation.ConfigValidationResult;
|
import org.apache.sqoop.validation.ConfigValidationResult;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json.util;
|
package org.apache.sqoop.json.util;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -36,7 +36,7 @@
|
|||||||
import org.apache.sqoop.model.MMapInput;
|
import org.apache.sqoop.model.MMapInput;
|
||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -72,7 +72,7 @@ public void testAllDataTypes() {
|
|||||||
assertEquals("A", retrieved.getStringInput("String").getValue());
|
assertEquals("A", retrieved.getStringInput("String").getValue());
|
||||||
assertEquals(map, retrieved.getMapInput("Map").getValue());
|
assertEquals(map, retrieved.getMapInput("Map").getValue());
|
||||||
assertEquals(1, (int)retrieved.getIntegerInput("Integer").getValue());
|
assertEquals(1, (int)retrieved.getIntegerInput("Integer").getValue());
|
||||||
assertEquals(true, retrieved.getBooleanInput("Boolean").getValue());
|
assertEquals(true, retrieved.getBooleanInput("Boolean").getValue().booleanValue());
|
||||||
assertEquals("YES", retrieved.getEnumInput("Enum").getValue());
|
assertEquals("YES", retrieved.getEnumInput("Enum").getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ public void testMapDataType() {
|
|||||||
assertEquals(map, retrieved.getMapInput("Map").getValue());
|
assertEquals(map, retrieved.getMapInput("Map").getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=SqoopException.class)
|
@Test(expectedExceptions=SqoopException.class)
|
||||||
public void testMapDataTypeException() {
|
public void testMapDataTypeException() {
|
||||||
MConfig config = getMapConfig();
|
MConfig config = getMapConfig();
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.json.util;
|
package org.apache.sqoop.json.util;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@ -43,7 +43,7 @@
|
|||||||
import org.apache.sqoop.schema.type.Time;
|
import org.apache.sqoop.schema.type.Time;
|
||||||
import org.apache.sqoop.schema.type.Unknown;
|
import org.apache.sqoop.schema.type.Unknown;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -64,25 +64,25 @@ public void testNullSchemaObject() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testEmptySchemaName() {
|
public void testEmptySchemaName() {
|
||||||
Schema schema = new Schema("");
|
Schema schema = new Schema("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testNullSchemaName() {
|
public void testNullSchemaName() {
|
||||||
Schema schema = new Schema(null);
|
Schema schema = new Schema(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testSchemaWithNullColumnName() {
|
public void testSchemaWithNullColumnName() {
|
||||||
Schema schema = new Schema("test").addColumn(new Text(null));
|
Schema schema = new Schema("test").addColumn(new Text(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testSchemaWithEmptyColumnName() {
|
public void testSchemaWithEmptyColumnName() {
|
||||||
Schema schema = new Schema("test").addColumn(new Text(""));
|
Schema schema = new Schema("test").addColumn(new Text(""));
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MAccountableEntity
|
* Test class for org.apache.sqoop.model.MAccountableEntity
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MBooleanInput
|
* Test class for org.apache.sqoop.model.MBooleanInput
|
||||||
@ -67,7 +67,7 @@ public void testEquals() {
|
|||||||
public void testValue() {
|
public void testValue() {
|
||||||
MBooleanInput input1 = new MBooleanInput("sqoopsqoop", true);
|
MBooleanInput input1 = new MBooleanInput("sqoopsqoop", true);
|
||||||
input1.setValue(true);
|
input1.setValue(true);
|
||||||
assertEquals(true, input1.getValue());
|
assertEquals(true, input1.getValue().booleanValue());
|
||||||
input1.setEmpty();
|
input1.setEmpty();
|
||||||
assertNull(input1.getValue());
|
assertNull(input1.getValue());
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ public void testUrlSafe() {
|
|||||||
String tmp = input1.getUrlSafeValueString();
|
String tmp = input1.getUrlSafeValueString();
|
||||||
// Restore to actual value
|
// Restore to actual value
|
||||||
input1.restoreFromUrlSafeValueString(tmp);
|
input1.restoreFromUrlSafeValueString(tmp);
|
||||||
assertEquals(true, input1.getValue());
|
assertEquals(true, input1.getValue().booleanValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class TestMConfig {
|
public class TestMConfig {
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
public class TestMConfigList {
|
public class TestMConfigList {
|
||||||
@Test
|
@Test
|
||||||
|
@ -17,19 +17,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotEquals;
|
import static org.testng.Assert.assertNotEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.sqoop.common.Direction;
|
import org.apache.sqoop.common.Direction;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestMConnector {
|
public class TestMConnector {
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.sqoop.json.DriverBean;
|
import org.apache.sqoop.json.DriverBean;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestMDriver {
|
public class TestMDriver {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.AssertJUnit.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MEnumInput
|
* Test class for org.apache.sqoop.model.MEnumInput
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MInputInput
|
* Test class for org.apache.sqoop.model.MInputInput
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.sqoop.common.Direction;
|
import org.apache.sqoop.common.Direction;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestMJob {
|
public class TestMJob {
|
||||||
/**
|
/**
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class TestMJobConfig {
|
public class TestMJobConfig {
|
||||||
/**
|
/**
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class TestMLink {
|
public class TestMLink {
|
||||||
|
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class TestMLinkConfig {
|
public class TestMLinkConfig {
|
||||||
|
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MMapInput
|
* Test class for org.apache.sqoop.model.MMapInput
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MNamedElement
|
* Test class for org.apache.sqoop.model.MNamedElement
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
public class TestMPersistableEntity {
|
public class TestMPersistableEntity {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.model;
|
package org.apache.sqoop.model;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MStringInput
|
* Test class for org.apache.sqoop.model.MStringInput
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.validation.Message;
|
import org.apache.sqoop.validation.Message;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.model.MValidatedElement
|
* Test class for org.apache.sqoop.model.MValidatedElement
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.schema.type;
|
package org.apache.sqoop.schema.type;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestArray {
|
public class TestArray {
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.schema.type;
|
package org.apache.sqoop.schema.type;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestEnum {
|
public class TestEnum {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.schema.type;
|
package org.apache.sqoop.schema.type;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestMap {
|
public class TestMap {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.schema.type;
|
package org.apache.sqoop.schema.type;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestSet {
|
public class TestSet {
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.submission;
|
package org.apache.sqoop.submission;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.submission.SubmissionStatus
|
* Test class for org.apache.sqoop.submission.SubmissionStatus
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.submission.counter;
|
package org.apache.sqoop.submission.counter;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.submission.counter.Counter
|
* Test class for org.apache.sqoop.submission.counter.Counter
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.submission.counter;
|
package org.apache.sqoop.submission.counter;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for org.apache.sqoop.submission.counter.CounterGroup
|
* Test class for org.apache.sqoop.submission.counter.CounterGroup
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.submission.counter;
|
package org.apache.sqoop.submission.counter;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Class for org.apache.sqoop.submission.counter.TestCounters
|
* Test Class for org.apache.sqoop.submission.counter.TestCounters
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.utils;
|
package org.apache.sqoop.utils;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.testng.AssertJUnit.assertArrayEquals;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.utils;
|
package org.apache.sqoop.utils;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.validation;
|
package org.apache.sqoop.validation;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
import org.apache.sqoop.validation.validators.NotEmpty;
|
import org.apache.sqoop.validation.validators.NotEmpty;
|
||||||
import org.apache.sqoop.validation.validators.NotNull;
|
import org.apache.sqoop.validation.validators.NotNull;
|
||||||
import org.apache.sqoop.validation.validators.AbstractValidator;
|
import org.apache.sqoop.validation.validators.AbstractValidator;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Message;
|
import org.apache.sqoop.validation.Message;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestClassAvailable {
|
public class TestClassAvailable {
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -18,16 +18,16 @@
|
|||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
public class TestHostAndPortValidator {
|
public class TestHostAndPortValidator {
|
||||||
|
|
||||||
AbstractValidator<String> validator = new HostAndPortValidator();
|
AbstractValidator<String> validator = new HostAndPortValidator();
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
validator.reset();
|
validator.reset();
|
||||||
assertEquals(0, validator.getMessages().size());
|
assertEquals(0, validator.getMessages().size());
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.validation.Message;
|
import org.apache.sqoop.validation.Message;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.validation.Message;
|
import org.apache.sqoop.validation.Message;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
package org.apache.sqoop.validation.validators;
|
package org.apache.sqoop.validation.validators;
|
||||||
|
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.validation.Message;
|
import org.apache.sqoop.validation.Message;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -49,8 +49,8 @@ limitations under the License.
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.jdbc;
|
package org.apache.sqoop.connector.jdbc;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
public class GenericJdbcExecutorTest {
|
public class GenericJdbcExecutorTest {
|
||||||
private final String table;
|
private final String table;
|
||||||
@ -37,7 +37,7 @@ public GenericJdbcExecutorTest() {
|
|||||||
GenericJdbcTestConstants.URL, null, null);
|
GenericJdbcTestConstants.URL, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
if(executor.existTable(emptyTable)) {
|
if(executor.existTable(emptyTable)) {
|
||||||
executor.executeUpdate("DROP TABLE " + emptyTable);
|
executor.executeUpdate("DROP TABLE " + emptyTable);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.jdbc;
|
package org.apache.sqoop.connector.jdbc;
|
||||||
|
|
||||||
|
|
||||||
import org.apache.sqoop.common.MutableContext;
|
import org.apache.sqoop.common.MutableContext;
|
||||||
import org.apache.sqoop.common.MutableMapContext;
|
import org.apache.sqoop.common.MutableMapContext;
|
||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
@ -32,12 +31,12 @@
|
|||||||
import org.apache.sqoop.schema.type.FixedPoint;
|
import org.apache.sqoop.schema.type.FixedPoint;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.joda.time.LocalDate;
|
import org.joda.time.LocalDate;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
|
|
||||||
public class TestExtractor {
|
public class TestExtractor {
|
||||||
@ -55,7 +54,7 @@ public TestExtractor() {
|
|||||||
tableName = getClass().getSimpleName().toUpperCase();
|
tableName = getClass().getSimpleName().toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
||||||
GenericJdbcTestConstants.URL, null, null);
|
GenericJdbcTestConstants.URL, null, null);
|
||||||
@ -74,7 +73,7 @@ public void setUp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
executor.close();
|
executor.close();
|
||||||
}
|
}
|
||||||
@ -159,7 +158,7 @@ public void testSubquery() throws Exception {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testIncorrectSchemaColumnSize() throws Exception {
|
public void testIncorrectSchemaColumnSize() throws Exception {
|
||||||
MutableContext context = new MutableMapContext();
|
MutableContext context = new MutableMapContext();
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@
|
|||||||
import org.apache.sqoop.schema.type.FixedPoint;
|
import org.apache.sqoop.schema.type.FixedPoint;
|
||||||
import org.apache.sqoop.schema.type.FloatingPoint;
|
import org.apache.sqoop.schema.type.FloatingPoint;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
public class TestFromInitializer {
|
public class TestFromInitializer {
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ public TestFromInitializer() {
|
|||||||
tableColumns = "ICOL,VCOL";
|
tableColumns = "ICOL,VCOL";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
||||||
GenericJdbcTestConstants.URL, null, null);
|
GenericJdbcTestConstants.URL, null, null);
|
||||||
@ -108,7 +108,7 @@ public Schema getSchema(String name) {
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
executor.close();
|
executor.close();
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@
|
|||||||
import org.apache.sqoop.model.MLinkConfig;
|
import org.apache.sqoop.model.MLinkConfig;
|
||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.apache.sqoop.model.MToConfig;
|
import org.apache.sqoop.model.MToConfig;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test upgrader.
|
* Test upgrader.
|
||||||
@ -42,7 +42,7 @@ public class TestGenericJdbcConnectorUpgrader {
|
|||||||
|
|
||||||
private GenericJdbcConnectorUpgrader upgrader;
|
private GenericJdbcConnectorUpgrader upgrader;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
upgrader = new GenericJdbcConnectorUpgrader();
|
upgrader = new GenericJdbcConnectorUpgrader();
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,6 @@
|
|||||||
package org.apache.sqoop.connector.jdbc;
|
package org.apache.sqoop.connector.jdbc;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import org.apache.sqoop.common.MutableContext;
|
import org.apache.sqoop.common.MutableContext;
|
||||||
import org.apache.sqoop.common.MutableMapContext;
|
import org.apache.sqoop.common.MutableMapContext;
|
||||||
@ -28,17 +26,15 @@
|
|||||||
import org.apache.sqoop.etl.io.DataReader;
|
import org.apache.sqoop.etl.io.DataReader;
|
||||||
import org.apache.sqoop.job.etl.Loader;
|
import org.apache.sqoop.job.etl.Loader;
|
||||||
import org.apache.sqoop.job.etl.LoaderContext;
|
import org.apache.sqoop.job.etl.LoaderContext;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.junit.runner.RunWith;
|
import org.testng.annotations.Factory;
|
||||||
import org.junit.runners.Parameterized;
|
import org.testng.annotations.Test;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public class TestLoader {
|
public class TestLoader {
|
||||||
|
|
||||||
private final String tableName;
|
private final String tableName;
|
||||||
@ -49,17 +45,18 @@ public class TestLoader {
|
|||||||
|
|
||||||
private int numberOfRows;
|
private int numberOfRows;
|
||||||
|
|
||||||
@Parameters
|
@DataProvider(name="test-jdbc-loader")
|
||||||
public static Collection<Object[]> data() {
|
public static Object[][] data() {
|
||||||
return Arrays.asList(new Object[][] {{50}, {100}, {101}, {150}, {200}});
|
return new Object[][] {{50}, {100}, {101}, {150}, {200}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Factory(dataProvider="test-jdbc-loader")
|
||||||
public TestLoader(int numberOfRows) {
|
public TestLoader(int numberOfRows) {
|
||||||
this.numberOfRows = numberOfRows;
|
this.numberOfRows = numberOfRows;
|
||||||
tableName = getClass().getSimpleName().toUpperCase();
|
this.tableName = getClass().getSimpleName().toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
||||||
GenericJdbcTestConstants.URL, null, null);
|
GenericJdbcTestConstants.URL, null, null);
|
||||||
@ -73,7 +70,7 @@ public void setUp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
executor.close();
|
executor.close();
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
import org.apache.sqoop.job.etl.Partition;
|
import org.apache.sqoop.job.etl.Partition;
|
||||||
import org.apache.sqoop.job.etl.Partitioner;
|
import org.apache.sqoop.job.etl.Partitioner;
|
||||||
import org.apache.sqoop.job.etl.PartitionerContext;
|
import org.apache.sqoop.job.etl.PartitionerContext;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
public class TestPartitioner {
|
public class TestPartitioner {
|
||||||
|
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.jdbc;
|
package org.apache.sqoop.connector.jdbc;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
|
|
||||||
import org.apache.sqoop.common.MutableContext;
|
import org.apache.sqoop.common.MutableContext;
|
||||||
import org.apache.sqoop.common.MutableMapContext;
|
import org.apache.sqoop.common.MutableMapContext;
|
||||||
@ -31,9 +31,9 @@
|
|||||||
import org.apache.sqoop.validation.ConfigValidationResult;
|
import org.apache.sqoop.validation.ConfigValidationResult;
|
||||||
import org.apache.sqoop.validation.ConfigValidationRunner;
|
import org.apache.sqoop.validation.ConfigValidationRunner;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestToInitializer {
|
public class TestToInitializer {
|
||||||
private final String schemaName;
|
private final String schemaName;
|
||||||
@ -57,7 +57,7 @@ public TestToInitializer() {
|
|||||||
tableColumns = "ICOL,VCOL";
|
tableColumns = "ICOL,VCOL";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
executor = new GenericJdbcExecutor(GenericJdbcTestConstants.DRIVER,
|
||||||
GenericJdbcTestConstants.URL, null, null);
|
GenericJdbcTestConstants.URL, null, null);
|
||||||
@ -74,7 +74,7 @@ public void setUp() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
executor.close();
|
executor.close();
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ limitations under the License.
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.SEQUENCE_FILE;
|
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.SEQUENCE_FILE;
|
||||||
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.TEXT_FILE;
|
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.TEXT_FILE;
|
||||||
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -36,14 +37,13 @@
|
|||||||
import org.apache.sqoop.etl.io.DataWriter;
|
import org.apache.sqoop.etl.io.DataWriter;
|
||||||
import org.apache.sqoop.job.etl.Extractor;
|
import org.apache.sqoop.job.etl.Extractor;
|
||||||
import org.apache.sqoop.job.etl.ExtractorContext;
|
import org.apache.sqoop.job.etl.ExtractorContext;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.junit.runner.RunWith;
|
import org.testng.annotations.Factory;
|
||||||
import org.junit.runners.Parameterized;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public class TestExtractor extends TestHdfsBase {
|
public class TestExtractor extends TestHdfsBase {
|
||||||
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
||||||
private static final int NUMBER_OF_FILES = 5;
|
private static final int NUMBER_OF_FILES = 5;
|
||||||
@ -54,6 +54,7 @@ public class TestExtractor extends TestHdfsBase {
|
|||||||
private final String inputDirectory;
|
private final String inputDirectory;
|
||||||
private Extractor<LinkConfiguration, FromJobConfiguration, HdfsPartition> extractor;
|
private Extractor<LinkConfiguration, FromJobConfiguration, HdfsPartition> extractor;
|
||||||
|
|
||||||
|
@Factory(dataProvider="test-hdfs-extractor")
|
||||||
public TestExtractor(ToFormat outputFileType,
|
public TestExtractor(ToFormat outputFileType,
|
||||||
Class<? extends CompressionCodec> compressionClass)
|
Class<? extends CompressionCodec> compressionClass)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
@ -63,18 +64,18 @@ public TestExtractor(ToFormat outputFileType,
|
|||||||
this.extractor = new HdfsExtractor();
|
this.extractor = new HdfsExtractor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameterized.Parameters
|
@DataProvider(name="test-hdfs-extractor")
|
||||||
public static Collection<Object[]> data() {
|
public static Object[][] data() {
|
||||||
List<Object[]> parameters = new ArrayList<Object[]>();
|
List<Object[]> parameters = new ArrayList<Object[]>();
|
||||||
for (Class<?> compressionClass : new Class<?>[]{null, DefaultCodec.class, BZip2Codec.class}) {
|
for (Class<?> compressionClass : new Class<?>[]{null, DefaultCodec.class, BZip2Codec.class}) {
|
||||||
for (Object outputFileType : new Object[]{TEXT_FILE, SEQUENCE_FILE}) {
|
for (Object outputFileType : new Object[]{TEXT_FILE, SEQUENCE_FILE}) {
|
||||||
parameters.add(new Object[]{outputFileType, compressionClass});
|
parameters.add(new Object[]{outputFileType, compressionClass});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters.toArray(new Object[0][]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
FileUtils.mkdirs(inputDirectory);
|
FileUtils.mkdirs(inputDirectory);
|
||||||
switch (this.outputFileType) {
|
switch (this.outputFileType) {
|
||||||
@ -88,7 +89,7 @@ public void setUp() throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
FileUtils.delete(inputDirectory);
|
FileUtils.delete(inputDirectory);
|
||||||
}
|
}
|
||||||
@ -140,7 +141,7 @@ public void writeRecord(Object obj) {
|
|||||||
extractor.extract(context, emptyLinkConfig, emptyJobConfig, partition);
|
extractor.extract(context, emptyLinkConfig, emptyJobConfig, partition);
|
||||||
|
|
||||||
for (int index = 0; index < NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE; ++index) {
|
for (int index = 0; index < NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE; ++index) {
|
||||||
Assert.assertTrue("Index " + (index + 1) + " was not visited", visited[index]);
|
assertTrue("Index " + (index + 1) + " was not visited", visited[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ public void writeRecord(Object obj) {
|
|||||||
extractor.extract(context, emptyLinkConfig, fromJobConfiguration, partition);
|
extractor.extract(context, emptyLinkConfig, fromJobConfiguration, partition);
|
||||||
|
|
||||||
for (int index = 0; index < NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE; ++index) {
|
for (int index = 0; index < NUMBER_OF_FILES * NUMBER_OF_ROWS_PER_FILE; ++index) {
|
||||||
Assert.assertTrue("Index " + (index + 1) + " was not visited", visited[index]);
|
assertTrue("Index " + (index + 1) + " was not visited", visited[index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,9 +21,13 @@
|
|||||||
import org.apache.sqoop.connector.hdfs.configuration.FromJobConfiguration;
|
import org.apache.sqoop.connector.hdfs.configuration.FromJobConfiguration;
|
||||||
import org.apache.sqoop.connector.hdfs.configuration.LinkConfiguration;
|
import org.apache.sqoop.connector.hdfs.configuration.LinkConfiguration;
|
||||||
import org.apache.sqoop.connector.hdfs.configuration.ToJobConfiguration;
|
import org.apache.sqoop.connector.hdfs.configuration.ToJobConfiguration;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.assertFalse;
|
||||||
|
import static org.testng.Assert.assertNotEquals;
|
||||||
|
import static org.testng.Assert.assertTrue;
|
||||||
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
|
||||||
|
|
||||||
public class TestHdfsUtils {
|
public class TestHdfsUtils {
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
package org.apache.sqoop.connector.hdfs;
|
package org.apache.sqoop.connector.hdfs;
|
||||||
|
|
||||||
import org.apache.sqoop.connector.hdfs.configuration.LinkConfig;
|
import org.apache.sqoop.connector.hdfs.configuration.LinkConfig;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.AssertJUnit.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
public class TestLinkConfig {
|
public class TestLinkConfig {
|
||||||
@Test
|
@Test
|
||||||
|
@ -44,14 +44,13 @@
|
|||||||
import org.apache.sqoop.etl.io.DataReader;
|
import org.apache.sqoop.etl.io.DataReader;
|
||||||
import org.apache.sqoop.job.etl.Loader;
|
import org.apache.sqoop.job.etl.Loader;
|
||||||
import org.apache.sqoop.job.etl.LoaderContext;
|
import org.apache.sqoop.job.etl.LoaderContext;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.junit.runner.RunWith;
|
import org.testng.annotations.Factory;
|
||||||
import org.junit.runners.Parameterized;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public class TestLoader extends TestHdfsBase {
|
public class TestLoader extends TestHdfsBase {
|
||||||
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
||||||
private static final int NUMBER_OF_ROWS_PER_FILE = 1000;
|
private static final int NUMBER_OF_ROWS_PER_FILE = 1000;
|
||||||
@ -61,6 +60,7 @@ public class TestLoader extends TestHdfsBase {
|
|||||||
private final String outputDirectory;
|
private final String outputDirectory;
|
||||||
private Loader loader;
|
private Loader loader;
|
||||||
|
|
||||||
|
@Factory(dataProvider="test-hdfs-loader")
|
||||||
public TestLoader(ToFormat outputFormat,
|
public TestLoader(ToFormat outputFormat,
|
||||||
ToCompression compression)
|
ToCompression compression)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
@ -70,8 +70,8 @@ public TestLoader(ToFormat outputFormat,
|
|||||||
this.loader = new HdfsLoader();
|
this.loader = new HdfsLoader();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameterized.Parameters
|
@DataProvider(name="test-hdfs-loader")
|
||||||
public static Collection<Object[]> data() {
|
public static Object[][] data() {
|
||||||
List<Object[]> parameters = new ArrayList<Object[]>();
|
List<Object[]> parameters = new ArrayList<Object[]>();
|
||||||
for (ToCompression compression : new ToCompression[]{
|
for (ToCompression compression : new ToCompression[]{
|
||||||
ToCompression.DEFAULT,
|
ToCompression.DEFAULT,
|
||||||
@ -82,13 +82,13 @@ public static Collection<Object[]> data() {
|
|||||||
parameters.add(new Object[]{outputFileType, compression});
|
parameters.add(new Object[]{outputFileType, compression});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters.toArray(new Object[0][]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() throws Exception {}
|
public void setUp() throws Exception {}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
FileUtils.delete(outputDirectory);
|
FileUtils.delete(outputDirectory);
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,10 @@
|
|||||||
|
|
||||||
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.SEQUENCE_FILE;
|
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.SEQUENCE_FILE;
|
||||||
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.TEXT_FILE;
|
import static org.apache.sqoop.connector.hdfs.configuration.ToFormat.TEXT_FILE;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.hadoop.conf.Configuration;
|
import org.apache.hadoop.conf.Configuration;
|
||||||
@ -37,13 +36,12 @@
|
|||||||
import org.apache.sqoop.job.etl.Partition;
|
import org.apache.sqoop.job.etl.Partition;
|
||||||
import org.apache.sqoop.job.etl.Partitioner;
|
import org.apache.sqoop.job.etl.Partitioner;
|
||||||
import org.apache.sqoop.job.etl.PartitionerContext;
|
import org.apache.sqoop.job.etl.PartitionerContext;
|
||||||
import org.junit.After;
|
import org.testng.annotations.AfterMethod;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.DataProvider;
|
||||||
import org.junit.runner.RunWith;
|
import org.testng.annotations.Factory;
|
||||||
import org.junit.runners.Parameterized;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
|
||||||
public class TestPartitioner extends TestHdfsBase {
|
public class TestPartitioner extends TestHdfsBase {
|
||||||
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
private static final String INPUT_ROOT = System.getProperty("maven.build.directory", "/tmp") + "/sqoop/warehouse/";
|
||||||
private static final int NUMBER_OF_FILES = 5;
|
private static final int NUMBER_OF_FILES = 5;
|
||||||
@ -55,13 +53,14 @@ public class TestPartitioner extends TestHdfsBase {
|
|||||||
|
|
||||||
private final String inputDirectory;
|
private final String inputDirectory;
|
||||||
|
|
||||||
|
@Factory(dataProvider="test-hdfs-partitioner")
|
||||||
public TestPartitioner(ToFormat outputFileType, Class<? extends CompressionCodec> compressionClass) {
|
public TestPartitioner(ToFormat outputFileType, Class<? extends CompressionCodec> compressionClass) {
|
||||||
this.inputDirectory = INPUT_ROOT + getClass().getSimpleName();
|
this.inputDirectory = INPUT_ROOT + getClass().getSimpleName();
|
||||||
this.outputFileType = outputFileType;
|
this.outputFileType = outputFileType;
|
||||||
this.compressionClass = compressionClass;
|
this.compressionClass = compressionClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
partitioner = new HdfsPartitioner();
|
partitioner = new HdfsPartitioner();
|
||||||
FileUtils.mkdirs(inputDirectory);
|
FileUtils.mkdirs(inputDirectory);
|
||||||
@ -77,20 +76,20 @@ public void setUp() throws Exception {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() throws IOException {
|
public void tearDown() throws IOException {
|
||||||
FileUtils.delete(inputDirectory);
|
FileUtils.delete(inputDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Parameterized.Parameters
|
@DataProvider(name="test-hdfs-partitioner")
|
||||||
public static Collection<Object[]> data() {
|
public static Object[][] data() {
|
||||||
List<Object[]> parameters = new ArrayList<Object[]>();
|
List<Object[]> parameters = new ArrayList<Object[]>();
|
||||||
for (Class<?> compressionClass : new Class<?>[]{null, DefaultCodec.class, BZip2Codec.class}) {
|
for (Class<?> compressionClass : new Class<?>[]{null, DefaultCodec.class, BZip2Codec.class}) {
|
||||||
for (Object outputFileType : new Object[]{TEXT_FILE, SEQUENCE_FILE}) {
|
for (Object outputFileType : new Object[]{TEXT_FILE, SEQUENCE_FILE}) {
|
||||||
parameters.add(new Object[]{outputFileType, compressionClass});
|
parameters.add(new Object[]{outputFileType, compressionClass});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parameters;
|
return parameters.toArray(new Object[0][]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -42,6 +42,12 @@ limitations under the License.
|
|||||||
<groupId>org.apache.sqoop</groupId>
|
<groupId>org.apache.sqoop</groupId>
|
||||||
<artifactId>sqoop-common-test</artifactId>
|
<artifactId>sqoop-common-test</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -23,7 +23,7 @@
|
|||||||
import org.apache.sqoop.job.etl.Destroyer;
|
import org.apache.sqoop.job.etl.Destroyer;
|
||||||
import org.apache.sqoop.job.etl.DestroyerContext;
|
import org.apache.sqoop.job.etl.DestroyerContext;
|
||||||
|
|
||||||
public class KafkaToDestroyer extends Destroyer<LinkConfiguration,ToJobConfiguration> {
|
public class KafkaToDestroyer extends Destroyer<LinkConfiguration, ToJobConfiguration> {
|
||||||
|
|
||||||
private static final Logger LOG = Logger.getLogger(KafkaToDestroyer.class);
|
private static final Logger LOG = Logger.getLogger(KafkaToDestroyer.class);
|
||||||
|
|
||||||
|
@ -21,9 +21,9 @@
|
|||||||
import org.apache.sqoop.validation.ConfigValidationResult;
|
import org.apache.sqoop.validation.ConfigValidationResult;
|
||||||
import org.apache.sqoop.validation.ConfigValidationRunner;
|
import org.apache.sqoop.validation.ConfigValidationRunner;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
public class TestConfiguration {
|
public class TestConfiguration {
|
||||||
@Test
|
@Test
|
||||||
|
@ -18,23 +18,21 @@
|
|||||||
package org.apache.sqoop.connector.kafka;
|
package org.apache.sqoop.connector.kafka;
|
||||||
|
|
||||||
import kafka.message.MessageAndMetadata;
|
import kafka.message.MessageAndMetadata;
|
||||||
import org.apache.sqoop.common.test.categories.SlowTests;
|
|
||||||
import org.apache.sqoop.connector.kafka.configuration.ToJobConfiguration;
|
import org.apache.sqoop.connector.kafka.configuration.ToJobConfiguration;
|
||||||
import org.apache.sqoop.connector.kafka.configuration.LinkConfiguration;
|
import org.apache.sqoop.connector.kafka.configuration.LinkConfiguration;
|
||||||
import org.apache.sqoop.common.test.kafka.TestUtil;
|
import org.apache.sqoop.common.test.kafka.TestUtil;
|
||||||
import org.apache.sqoop.etl.io.DataReader;
|
import org.apache.sqoop.etl.io.DataReader;
|
||||||
import org.apache.sqoop.job.etl.LoaderContext;
|
import org.apache.sqoop.job.etl.LoaderContext;
|
||||||
import org.junit.AfterClass;
|
import org.testng.annotations.AfterClass;
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.BeforeClass;
|
import org.testng.annotations.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Category({ SlowTests.class })
|
@Test(groups="slow")
|
||||||
public class TestKafkaLoader {
|
public class TestKafkaLoader {
|
||||||
|
|
||||||
private static TestUtil testUtil = TestUtil.getInstance();
|
private static TestUtil testUtil = TestUtil.getInstance();
|
||||||
|
@ -44,8 +44,8 @@ limitations under the License.
|
|||||||
|
|
||||||
<!-- Testing specified modules -->
|
<!-- Testing specified modules -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -55,7 +55,7 @@ limitations under the License.
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.powermock</groupId>
|
<groupId>org.powermock</groupId>
|
||||||
<artifactId>powermock-module-junit4</artifactId>
|
<artifactId>powermock-module-testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -20,24 +20,24 @@
|
|||||||
import org.apache.avro.Schema;
|
import org.apache.avro.Schema;
|
||||||
import org.apache.avro.generic.GenericRecord;
|
import org.apache.avro.generic.GenericRecord;
|
||||||
import org.apache.avro.generic.GenericRecordBuilder;
|
import org.apache.avro.generic.GenericRecordBuilder;
|
||||||
import org.junit.After;
|
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.kitesdk.data.Dataset;
|
import org.kitesdk.data.Dataset;
|
||||||
import org.kitesdk.data.DatasetDescriptor;
|
import org.kitesdk.data.DatasetDescriptor;
|
||||||
import org.kitesdk.data.DatasetReader;
|
import org.kitesdk.data.DatasetReader;
|
||||||
import org.kitesdk.data.DatasetWriter;
|
import org.kitesdk.data.DatasetWriter;
|
||||||
|
import org.testng.AssertJUnit;
|
||||||
|
import org.testng.IObjectFactory;
|
||||||
|
import org.testng.annotations.AfterMethod;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.ObjectFactory;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static junit.framework.Assert.assertEquals;
|
|
||||||
import static junit.framework.Assert.assertNotNull;
|
|
||||||
import static junit.framework.Assert.assertNull;
|
|
||||||
import static junit.framework.TestCase.assertTrue;
|
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.MockitoAnnotations.initMocks;
|
import static org.mockito.MockitoAnnotations.initMocks;
|
||||||
|
import static org.testng.AssertJUnit.assertTrue;
|
||||||
|
|
||||||
public class TestKiteExecutor {
|
public class TestKiteExecutor {
|
||||||
|
|
||||||
@ -55,7 +55,12 @@ public class TestKiteExecutor {
|
|||||||
|
|
||||||
private KiteDatasetExecutor executor;
|
private KiteDatasetExecutor executor;
|
||||||
|
|
||||||
@Before
|
@ObjectFactory
|
||||||
|
public IObjectFactory getObjectFactory() {
|
||||||
|
return new org.powermock.modules.testng.PowerMockObjectFactory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
when(datasetMock.newWriter()).thenReturn(writerMock);
|
when(datasetMock.newWriter()).thenReturn(writerMock);
|
||||||
@ -68,7 +73,7 @@ public void setUp() {
|
|||||||
executor = new KiteDatasetExecutor(datasetMock);
|
executor = new KiteDatasetExecutor(datasetMock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@AfterMethod
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
executor.closeWriter();
|
executor.closeWriter();
|
||||||
executor.closeReader();
|
executor.closeReader();
|
||||||
@ -117,14 +122,14 @@ public void testReaderRecord() {
|
|||||||
// exercise & verify
|
// exercise & verify
|
||||||
for (int i = 0; i < NUMBER_OF_ROWS; i++) {
|
for (int i = 0; i < NUMBER_OF_ROWS; i++) {
|
||||||
Object[] actual = executor.readRecord();
|
Object[] actual = executor.readRecord();
|
||||||
assertNotNull(actual);
|
AssertJUnit.assertNotNull(actual);
|
||||||
assertEquals(2, actual.length);
|
AssertJUnit.assertEquals(2, actual.length);
|
||||||
assertEquals(1, actual[0]);
|
AssertJUnit.assertEquals(1, actual[0]);
|
||||||
assertEquals("foo", actual[1]);
|
AssertJUnit.assertEquals("foo", actual[1]);
|
||||||
}
|
}
|
||||||
when(readerMock.hasNext()).thenReturn(false);
|
when(readerMock.hasNext()).thenReturn(false);
|
||||||
Object[] actual = executor.readRecord();
|
Object[] actual = executor.readRecord();
|
||||||
assertNull(actual);
|
AssertJUnit.assertNull(actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
import org.apache.sqoop.job.etl.ExtractorContext;
|
import org.apache.sqoop.job.etl.ExtractorContext;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.mockito.stubbing.OngoingStubbing;
|
import org.mockito.stubbing.OngoingStubbing;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
@ -56,7 +56,7 @@ public void writeRecord(Object obj) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
|
|
||||||
|
@ -20,24 +20,24 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.apache.sqoop.connector.kite.configuration.FromJobConfiguration;
|
import org.apache.sqoop.connector.kite.configuration.FromJobConfiguration;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.kitesdk.data.Datasets;
|
import org.kitesdk.data.Datasets;
|
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
import org.powermock.modules.testng.PowerMockTestCase;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.MockitoAnnotations.initMocks;
|
import static org.mockito.MockitoAnnotations.initMocks;
|
||||||
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
||||||
|
|
||||||
@RunWith(PowerMockRunner.class)
|
|
||||||
@PrepareForTest(Datasets.class)
|
@PrepareForTest(Datasets.class)
|
||||||
public class TestKiteFromInitializer {
|
@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
|
||||||
|
public class TestKiteFromInitializer extends PowerMockTestCase {
|
||||||
|
|
||||||
private KiteFromInitializer initializer;
|
private KiteFromInitializer initializer;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
mockStatic(Datasets.class);
|
mockStatic(Datasets.class);
|
||||||
@ -56,7 +56,7 @@ public void testInitializePassed() {
|
|||||||
initializer.initialize(null, null, jobConfig);
|
initializer.initialize(null, null, jobConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected=SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testInitializeFailed() {
|
public void testInitializeFailed() {
|
||||||
// setup
|
// setup
|
||||||
FromJobConfiguration jobConfig = new FromJobConfiguration();
|
FromJobConfiguration jobConfig = new FromJobConfiguration();
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
import org.apache.sqoop.job.etl.LoaderContext;
|
import org.apache.sqoop.job.etl.LoaderContext;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.mockito.Mockito.any;
|
import static org.mockito.Mockito.any;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
@ -40,7 +40,7 @@ public class TestKiteLoader {
|
|||||||
@org.mockito.Mock
|
@org.mockito.Mock
|
||||||
private KiteDatasetExecutor executorMock;
|
private KiteDatasetExecutor executorMock;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
|
import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
|
||||||
import org.apache.sqoop.job.etl.DestroyerContext;
|
import org.apache.sqoop.job.etl.DestroyerContext;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.kitesdk.data.Datasets;
|
import org.kitesdk.data.Datasets;
|
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
|
import org.powermock.modules.testng.PowerMockTestCase;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@ -37,9 +37,9 @@
|
|||||||
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
||||||
import static org.powermock.api.mockito.PowerMockito.verifyStatic;
|
import static org.powermock.api.mockito.PowerMockito.verifyStatic;
|
||||||
|
|
||||||
@RunWith(PowerMockRunner.class)
|
|
||||||
@PrepareForTest({KiteDatasetExecutor.class, Datasets.class})
|
@PrepareForTest({KiteDatasetExecutor.class, Datasets.class})
|
||||||
public class TestKiteToDestroyer {
|
@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
|
||||||
|
public class TestKiteToDestroyer extends PowerMockTestCase {
|
||||||
|
|
||||||
private KiteToDestroyer destroyer;
|
private KiteToDestroyer destroyer;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ public class TestKiteToDestroyer {
|
|||||||
@org.mockito.Mock
|
@org.mockito.Mock
|
||||||
private KiteDatasetExecutor executorMock;
|
private KiteDatasetExecutor executorMock;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
mockStatic(KiteDatasetExecutor.class);
|
mockStatic(KiteDatasetExecutor.class);
|
||||||
|
@ -22,26 +22,26 @@
|
|||||||
import org.apache.sqoop.connector.kite.configuration.LinkConfiguration;
|
import org.apache.sqoop.connector.kite.configuration.LinkConfiguration;
|
||||||
import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
|
import org.apache.sqoop.connector.kite.configuration.ToJobConfiguration;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.junit.Before;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import org.kitesdk.data.Datasets;
|
import org.kitesdk.data.Datasets;
|
||||||
|
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||||
|
import org.powermock.modules.testng.PowerMockTestCase;
|
||||||
|
import org.testng.annotations.BeforeMethod;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||||
import org.powermock.modules.junit4.PowerMockRunner;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.testng.Assert.assertNotNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.MockitoAnnotations.initMocks;
|
import static org.mockito.MockitoAnnotations.initMocks;
|
||||||
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
import static org.powermock.api.mockito.PowerMockito.mockStatic;
|
||||||
|
|
||||||
@RunWith(PowerMockRunner.class)
|
|
||||||
@PrepareForTest(Datasets.class)
|
@PrepareForTest(Datasets.class)
|
||||||
public class TestKiteToInitializer {
|
@PowerMockIgnore("org.apache.sqoop.common.ErrorCode")
|
||||||
|
public class TestKiteToInitializer extends PowerMockTestCase {
|
||||||
|
|
||||||
private KiteToInitializer initializer;
|
private KiteToInitializer initializer;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
initMocks(this);
|
initMocks(this);
|
||||||
mockStatic(Datasets.class);
|
mockStatic(Datasets.class);
|
||||||
@ -62,7 +62,7 @@ public void testInitializePassed() {
|
|||||||
initializer.initialize(null, linkConfig, toJobConfig);
|
initializer.initialize(null, linkConfig, toJobConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testInitializeFailed() {
|
public void testInitializeFailed() {
|
||||||
// setup
|
// setup
|
||||||
LinkConfiguration linkConfig = new LinkConfiguration();
|
LinkConfiguration linkConfig = new LinkConfiguration();
|
||||||
|
@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.kite.configuration;
|
package org.apache.sqoop.connector.kite.configuration;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test configuration objects.
|
* Test configuration objects.
|
||||||
|
@ -41,8 +41,8 @@ limitations under the License.
|
|||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.common;
|
package org.apache.sqoop.connector.common;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.testng.Assert.*;
|
||||||
import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
|
import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
|
||||||
|
|
||||||
import org.apache.sqoop.schema.type.AbstractComplexListType;
|
import org.apache.sqoop.schema.type.AbstractComplexListType;
|
||||||
import org.apache.sqoop.schema.type.Array;
|
import org.apache.sqoop.schema.type.Array;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
import static org.apache.sqoop.connector.common.SqoopAvroUtils.createEnumSchema;
|
import static org.apache.sqoop.connector.common.SqoopAvroUtils.createEnumSchema;
|
||||||
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import org.apache.avro.generic.GenericData;
|
import org.apache.avro.generic.GenericData;
|
||||||
import org.apache.avro.generic.GenericRecord;
|
import org.apache.avro.generic.GenericRecord;
|
||||||
@ -34,8 +34,8 @@
|
|||||||
import org.apache.sqoop.schema.type.FixedPoint;
|
import org.apache.sqoop.schema.type.FixedPoint;
|
||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -62,7 +62,7 @@ public class TestAVROIntermediateDataFormat {
|
|||||||
private final static org.joda.time.LocalTime time = new org.joda.time.LocalTime(12, 59, 59);
|
private final static org.joda.time.LocalTime time = new org.joda.time.LocalTime(12, 59, 59);
|
||||||
private final static org.joda.time.LocalDate date = new org.joda.time.LocalDate(2014, 10, 01);
|
private final static org.joda.time.LocalDate date = new org.joda.time.LocalDate(2014, 10, 01);
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
createAvroIDF();
|
createAvroIDF();
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.connector.idf;
|
package org.apache.sqoop.connector.idf;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.testng.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
|
import static org.apache.sqoop.connector.common.SqoopIDFUtils.*;
|
||||||
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
||||||
|
|
||||||
@ -46,14 +46,14 @@
|
|||||||
import org.apache.sqoop.schema.type.Text;
|
import org.apache.sqoop.schema.type.Text;
|
||||||
import org.apache.sqoop.schema.type.Time;
|
import org.apache.sqoop.schema.type.Time;
|
||||||
import org.joda.time.DateTimeZone;
|
import org.joda.time.DateTimeZone;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestCSVIntermediateDataFormat {
|
public class TestCSVIntermediateDataFormat {
|
||||||
|
|
||||||
private CSVIntermediateDataFormat dataFormat;
|
private CSVIntermediateDataFormat dataFormat;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
dataFormat = new CSVIntermediateDataFormat();
|
dataFormat = new CSVIntermediateDataFormat();
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ public void testNullInputAsCSVTextInObjectArrayOut() {
|
|||||||
assertNull(out);
|
assertNull(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testEmptyInputAsCSVTextInObjectArrayOut() {
|
public void testEmptyInputAsCSVTextInObjectArrayOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new FixedPoint("1")).addColumn(new FixedPoint("2")).addColumn(new Text("3")).addColumn(new Text("4"))
|
schema.addColumn(new FixedPoint("1")).addColumn(new FixedPoint("2")).addColumn(new Text("3")).addColumn(new Text("4"))
|
||||||
@ -508,7 +508,7 @@ public void testDateTimeWithFractionNoTimezoneWithCSVTextInObjectArrayOut() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// since date is not quoted
|
// since date is not quoted
|
||||||
@Test(expected = Exception.class)
|
@Test(expectedExceptions = Exception.class)
|
||||||
public void testDateTimeNoQuotesWithFractionTimezoneWithCSVTextInObjectArrayOut() {
|
public void testDateTimeNoQuotesWithFractionTimezoneWithCSVTextInObjectArrayOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new DateTime("1", true, true));
|
schema.addColumn(new DateTime("1", true, true));
|
||||||
@ -520,7 +520,7 @@ public void testDateTimeNoQuotesWithFractionTimezoneWithCSVTextInObjectArrayOut(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// since date is not in expected format
|
// since date is not in expected format
|
||||||
@Test(expected = Exception.class)
|
@Test(expectedExceptions = Exception.class)
|
||||||
public void testDateTimeIncorrectFormatWithCSVTextInObjectArrayOut() {
|
public void testDateTimeIncorrectFormatWithCSVTextInObjectArrayOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new DateTime("1", true, true));
|
schema.addColumn(new DateTime("1", true, true));
|
||||||
@ -636,7 +636,7 @@ public void testBitWithObjectArrayInAndCSVTextOut() {
|
|||||||
assertEquals("true,false", dataFormat.getCSVTextData());
|
assertEquals("true,false", dataFormat.getCSVTextData());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testUnsupportedBitWithObjectArrayInAndCSVTextOut() {
|
public void testUnsupportedBitWithObjectArrayInAndCSVTextOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
||||||
@ -682,7 +682,7 @@ public void testBitWithCSVTextInAndObjectArrayOut() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testUnsupportedBitWithObjectArrayInAndObjectOut() {
|
public void testUnsupportedBitWithObjectArrayInAndObjectOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
||||||
@ -695,7 +695,7 @@ public void testUnsupportedBitWithObjectArrayInAndObjectOut() {
|
|||||||
assertEquals(false, dataFormat.getObjectData()[1]);
|
assertEquals(false, dataFormat.getObjectData()[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testUnsupportedBitWithCSVTextInAndObjectOut() {
|
public void testUnsupportedBitWithCSVTextInAndObjectOut() {
|
||||||
Schema schema = new Schema("test");
|
Schema schema = new Schema("test");
|
||||||
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
schema.addColumn(new Bit("1")).addColumn(new Bit("2"));
|
||||||
@ -1101,7 +1101,7 @@ public void testMapWithCSVTextInCSVTextOut() {
|
|||||||
assertEquals(testData, dataFormat.getCSVTextData());
|
assertEquals(testData, dataFormat.getCSVTextData());
|
||||||
}
|
}
|
||||||
//**************test cases for schema*******************
|
//**************test cases for schema*******************
|
||||||
@Test(expected=SqoopException.class)
|
@Test(expectedExceptions=SqoopException.class)
|
||||||
public void testEmptySchema() {
|
public void testEmptySchema() {
|
||||||
String testData = "10,34,'54','random data'," + getByteFieldString(new byte[] { (byte) -112, (byte) 54})
|
String testData = "10,34,'54','random data'," + getByteFieldString(new byte[] { (byte) -112, (byte) 54})
|
||||||
+ ",'\\n'";
|
+ ",'\\n'";
|
||||||
@ -1113,14 +1113,14 @@ public void testEmptySchema() {
|
|||||||
Object[] out = dataFormat.getObjectData();
|
Object[] out = dataFormat.getObjectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testNullSchema() {
|
public void testNullSchema() {
|
||||||
dataFormat.setSchema(null);
|
dataFormat.setSchema(null);
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Object[] out = dataFormat.getObjectData();
|
Object[] out = dataFormat.getObjectData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SqoopException.class)
|
@Test(expectedExceptions = SqoopException.class)
|
||||||
public void testNotSettingSchema() {
|
public void testNotSettingSchema() {
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
Object[] out = dataFormat.getObjectData();
|
Object[] out = dataFormat.getObjectData();
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package org.apache.sqoop.connector.idf;
|
package org.apache.sqoop.connector.idf;
|
||||||
|
|
||||||
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
import static org.apache.sqoop.connector.common.TestSqoopIDFUtils.getByteFieldString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
|
|
||||||
import org.apache.sqoop.connector.common.SqoopIDFUtils;
|
import org.apache.sqoop.connector.common.SqoopIDFUtils;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
@ -31,8 +31,8 @@
|
|||||||
import org.joda.time.LocalDateTime;
|
import org.joda.time.LocalDateTime;
|
||||||
import org.json.simple.JSONArray;
|
import org.json.simple.JSONArray;
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -48,7 +48,7 @@ public class TestJSONIntermediateDataFormat {
|
|||||||
private final static String dateTime = "'2014-10-01 12:00:00.000'";
|
private final static String dateTime = "'2014-10-01 12:00:00.000'";
|
||||||
private final static String time = "'12:59:59'";
|
private final static String time = "'12:59:59'";
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
createJSONIDF();
|
createJSONIDF();
|
||||||
}
|
}
|
||||||
|
@ -20,16 +20,16 @@
|
|||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.apache.sqoop.schema.NullSchema;
|
import org.apache.sqoop.schema.NullSchema;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
|
||||||
|
|
||||||
public class TestLocationMatcher {
|
public class TestLocationMatcher {
|
||||||
|
|
||||||
private LocationMatcher matcher;
|
private LocationMatcher matcher;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
matcher = null;
|
matcher = null;
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ public void testConvertWhenToSchemaIsLongerThanFromSchema() {
|
|||||||
* If TO schema has more fields than FROM schema, and NOT all of the extra
|
* If TO schema has more fields than FROM schema, and NOT all of the extra
|
||||||
* fields are "nullable", a SqoopException is expected.
|
* fields are "nullable", a SqoopException is expected.
|
||||||
*/
|
*/
|
||||||
@Test (expected = SqoopException.class)
|
@Test (expectedExceptions = SqoopException.class)
|
||||||
public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
|
public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
|
||||||
Schema from = SchemaFixture.createSchema("from", 2);
|
Schema from = SchemaFixture.createSchema("from", 2);
|
||||||
Schema to = SchemaFixture.createSchema("to", 4);
|
Schema to = SchemaFixture.createSchema("to", 4);
|
||||||
|
@ -20,16 +20,16 @@
|
|||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.apache.sqoop.schema.NullSchema;
|
import org.apache.sqoop.schema.NullSchema;
|
||||||
import org.apache.sqoop.schema.Schema;
|
import org.apache.sqoop.schema.Schema;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
|
||||||
|
|
||||||
public class TestNameMatcher {
|
public class TestNameMatcher {
|
||||||
|
|
||||||
private NameMatcher matcher;
|
private NameMatcher matcher;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
matcher = null;
|
matcher = null;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ public void testConvertWhenToSchemaIsLongerThanFromSchema() {
|
|||||||
* If TO schema has more fields than FROM schema, and NOT all of the extra
|
* If TO schema has more fields than FROM schema, and NOT all of the extra
|
||||||
* fields are "nullable", a SqoopException is expected.
|
* fields are "nullable", a SqoopException is expected.
|
||||||
*/
|
*/
|
||||||
@Test (expected = SqoopException.class)
|
@Test (expectedExceptions = SqoopException.class)
|
||||||
public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
|
public void testConvertWhenToSchemaIsLongerThanFromSchemaFail() {
|
||||||
Schema from = SchemaFixture.createSchema("from",
|
Schema from = SchemaFixture.createSchema("from",
|
||||||
new String[]{"text1", "text2"});
|
new String[]{"text1", "text2"});
|
||||||
|
@ -49,8 +49,8 @@ limitations under the License.
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>org.testng</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>testng</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.sqoop.common.SqoopException;
|
import org.apache.sqoop.common.SqoopException;
|
||||||
import org.junit.Assert;
|
import org.testng.Assert;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestSqoopConfiguration {
|
public class TestSqoopConfiguration {
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
// Unset any configuration dir if it is set by another test
|
// Unset any configuration dir if it is set by another test
|
||||||
System.getProperties().remove(ConfigurationConstants.SYSPROP_CONFIG_DIR);
|
System.getProperties().remove(ConfigurationConstants.SYSPROP_CONFIG_DIR);
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.driver;
|
package org.apache.sqoop.driver;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.testng.Assert.assertNull;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -30,8 +30,8 @@
|
|||||||
import org.apache.sqoop.model.MInput;
|
import org.apache.sqoop.model.MInput;
|
||||||
import org.apache.sqoop.model.MIntegerInput;
|
import org.apache.sqoop.model.MIntegerInput;
|
||||||
import org.apache.sqoop.model.MStringInput;
|
import org.apache.sqoop.model.MStringInput;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ -39,7 +39,7 @@ public class TestDriverConfigUpgrader {
|
|||||||
|
|
||||||
DriverUpgrader upgrader;
|
DriverUpgrader upgrader;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void initializeUpgrader() {
|
public void initializeUpgrader() {
|
||||||
upgrader = new DriverUpgrader();
|
upgrader = new DriverUpgrader();
|
||||||
}
|
}
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
@ -38,8 +38,8 @@
|
|||||||
import org.apache.sqoop.repository.Repository;
|
import org.apache.sqoop.repository.Repository;
|
||||||
import org.apache.sqoop.repository.RepositoryManager;
|
import org.apache.sqoop.repository.RepositoryManager;
|
||||||
import org.apache.sqoop.request.HttpEventContext;
|
import org.apache.sqoop.request.HttpEventContext;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
public class TestJobManager {
|
public class TestJobManager {
|
||||||
private JobManager jobManager;
|
private JobManager jobManager;
|
||||||
@ -48,7 +48,7 @@ public class TestJobManager {
|
|||||||
private RepositoryManager repositoryManagerMock;
|
private RepositoryManager repositoryManagerMock;
|
||||||
private Repository jdbcRepoMock;
|
private Repository jdbcRepoMock;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
jobManager = new JobManager();
|
jobManager = new JobManager();
|
||||||
connectorMgrMock = mock(ConnectorManager.class);
|
connectorMgrMock = mock(ConnectorManager.class);
|
||||||
|
@ -23,17 +23,17 @@
|
|||||||
|
|
||||||
import org.apache.sqoop.driver.JobRequest;
|
import org.apache.sqoop.driver.JobRequest;
|
||||||
import org.apache.sqoop.utils.ClassUtils;
|
import org.apache.sqoop.utils.ClassUtils;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.testng.Assert.assertTrue;
|
||||||
|
|
||||||
public class TestJobRequest {
|
public class TestJobRequest {
|
||||||
|
|
||||||
private JobRequest jobRequest;
|
private JobRequest jobRequest;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void initializeSubmissionRequest() {
|
public void initializeSubmissionRequest() {
|
||||||
jobRequest = new JobRequest();
|
jobRequest = new JobRequest();
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.sqoop.repository;
|
package org.apache.sqoop.repository;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.testng.AssertJUnit.assertEquals;
|
||||||
import static org.junit.Assert.fail;
|
import static org.testng.Assert.fail;
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
import static org.mockito.Matchers.anyLong;
|
import static org.mockito.Matchers.anyLong;
|
||||||
import static org.mockito.Matchers.anyString;
|
import static org.mockito.Matchers.anyString;
|
||||||
@ -62,8 +62,8 @@
|
|||||||
import org.apache.sqoop.model.Validator;
|
import org.apache.sqoop.model.Validator;
|
||||||
import org.apache.sqoop.validation.Status;
|
import org.apache.sqoop.validation.Status;
|
||||||
import org.apache.sqoop.validation.validators.AbstractValidator;
|
import org.apache.sqoop.validation.validators.AbstractValidator;
|
||||||
import org.junit.Before;
|
import org.testng.annotations.BeforeMethod;
|
||||||
import org.junit.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.mockito.InOrder;
|
import org.mockito.InOrder;
|
||||||
|
|
||||||
public class TestJdbcRepository {
|
public class TestJdbcRepository {
|
||||||
@ -76,7 +76,7 @@ public class TestJdbcRepository {
|
|||||||
private ConnectorConfigurableUpgrader connectorUpgraderMock;
|
private ConnectorConfigurableUpgrader connectorUpgraderMock;
|
||||||
private DriverUpgrader driverUpgraderMock;
|
private DriverUpgrader driverUpgraderMock;
|
||||||
|
|
||||||
@Before
|
@BeforeMethod
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
repoTransactionMock = mock(JdbcRepositoryTransaction.class);
|
repoTransactionMock = mock(JdbcRepositoryTransaction.class);
|
||||||
connectorMgrMock = mock(ConnectorManager.class);
|
connectorMgrMock = mock(ConnectorManager.class);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user