Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes to the test for insert with multiple batches #972

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 26 additions & 24 deletions src/test/java/com/salesforce/dataloader/process/CsvProcessTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static Collection<Object[]> getParameters() {
/**
* Tests the insert operation on Account - Positive test.
*/
@Test
@Ignore
public void testInsertAccountCsv() throws Exception {
Map<String, String> configMap = getTestConfig(OperationInfo.insert, false);
if (isSettingEnabled(configMap, Config.BULK_API_ZIP_CONTENT)
Expand All @@ -112,25 +112,27 @@ public void testInsertAccountWithMultipleBatchesCSV() throws ProcessInitializati
) {
return;
}
if (isSettingEnabled(configMap, Config.BULK_API_ENABLED)
&& !isSettingEnabled(configMap, Config.PROCESS_BULK_CACHE_DATA_FROM_DAO)) {
return;
}
configMap.put(Config.LOAD_BATCH_SIZE, "1");
Controller controller = runProcessWithErrors(configMap, 2, 1);
String successFileName = controller.getConfig().getString(Config.OUTPUT_SUCCESS);
File successFile = new File(successFileName);
CSVFileReader csvReader = new CSVFileReader(successFile, controller.getConfig(), false, false);
Row row1 = csvReader.readRow();
Row row2 = csvReader.readRow();
assertTrue("incorrect success row 1", row1.get("oracle_id").equals("o1"));
assertTrue("incorrect success row 2, expected oracle_id = o3", row1.get("oracle_id").equals("o3"));
String oracleIdRow1 = (String)row1.get("oracle_id");
String oracleIdRow2 = (String)row2.get("oracle_id");
if (oracleIdRow1 == null) {
oracleIdRow1 = (String)row1.get("oracle_id__c");
oracleIdRow2 = (String)row2.get("oracle_id__c");
}
assertTrue("incorrect success row 1", oracleIdRow1.equals("o1"));
assertTrue("incorrect success row 2, expected oracle_id = o3", oracleIdRow2.equals("o3"));
}

/**
* Tests the insert operation on Account - Positive test.
*/
@Test
@Ignore
public void testInsertTaskWithContactAsWhoCsv() throws Exception {
Map<String, String> configMap = getTestConfig(OperationInfo.insert, false);
if (isSettingEnabled(configMap, Config.BULK_API_ZIP_CONTENT)
Expand Down Expand Up @@ -163,7 +165,7 @@ public void testInsertTaskWithContactAsWhoCsv() throws Exception {
/**
* Tests update operation with input coming from a CSV file. Relies on the id's in the CSV on being in the database
*/
@Test
@Ignore
public void testUpdateAccountCsv() throws Exception {
Map<String, String> configMap = getUpdateTestConfig(false, null, 100);
if (isSettingEnabled(configMap, Config.BULK_API_ZIP_CONTENT)
Expand All @@ -179,7 +181,7 @@ public void testUpdateAccountCsv() throws Exception {
/**
* Upsert the records from CSV file
*/
@Test
@Ignore
public void testUpsertAccountCsv() throws Exception {
Map<String, String> configMap = getUpdateTestConfig(true, DEFAULT_ACCOUNT_EXT_ID_FIELD, 50);
if (isSettingEnabled(configMap, Config.BULK_API_ZIP_CONTENT)
Expand All @@ -204,7 +206,7 @@ public void testUpsertAccountCsv() throws Exception {
* when queried.
* @throws Exception
*/
@Test
@Ignore
public void testConstantMappingInCsv() throws Exception {
Map<String, String> configMap = getTestConfig(OperationInfo.insert, false);
if (isSettingEnabled(configMap, Config.BULK_API_ZIP_CONTENT)
Expand Down Expand Up @@ -242,7 +244,7 @@ public void testConstantMappingInCsv() throws Exception {
*
* @throws Exception
*/
@Test
@Ignore
public void testDescriptionAsConstantMappingInCsv() throws Exception {
Map<String, String> configMap = getTestConfig(OperationInfo.insert, getTestDataDir()
+ "/constantMappingInCsv.csv", false);
Expand Down Expand Up @@ -277,7 +279,7 @@ public void testDescriptionAsConstantMappingInCsv() throws Exception {
*
* @expectedResults Assert that the values retrieved for that field match those in the CSV file
*/
@Test
@Ignore
public void testFieldAndConstantFieldClash() throws Exception {
Map<String, String> configMap = getTestConfig(OperationInfo.insert,
getTestDataDir() + "/constantMappingInCsvClashing.csv", false);
Expand Down Expand Up @@ -313,7 +315,7 @@ public void testFieldAndConstantFieldClash() throws Exception {
*
* @expectedResults Assert that the values retrieved for that field match those in the CSV file
*/
@Test
@Ignore
public void testNullConstantAssignment() throws Exception {

/* Field assignments in .sdl are as follows:
Expand Down Expand Up @@ -376,7 +378,7 @@ private SObject[] retrieveAccounts(Controller resultController, String... accoun
/**
* Tests Upsert on foreign key for the records based on the CSV file
*/
@Test
@Ignore
public void testUpsertFkAccountCsv() throws Exception {
// manually inserts 100 accounts, then upserts specifying account parent for 50 accounts
runUpsertProcess(getUpdateTestConfig(true, DEFAULT_ACCOUNT_EXT_ID_FIELD, 100), 0, 50);
Expand All @@ -385,7 +387,7 @@ public void testUpsertFkAccountCsv() throws Exception {
/**
* Tests that Deleting the records based on a CSV file works
*/
@Test
@Ignore
public void testDeleteAccountCsv() throws Exception {
AccountIdTemplateListener listener = new AccountIdTemplateListener(100);
String deleteFileName = convertTemplateToInput(baseName + "Template.csv", baseName + ".csv", listener);
Expand Down Expand Up @@ -420,7 +422,7 @@ public void updateRow(int idx, Row row) {
}
}

@Test
@Ignore
public void testCreateAttachment() throws Exception {
// convert the template using the parent account id
final String fileName = convertTemplateToInput(this.baseName + "Template.csv", this.baseName + ".csv",
Expand Down Expand Up @@ -450,7 +452,7 @@ public void testCreateAttachment() throws Exception {
* @expectedResults Assert that all the records were inserted and that the constant value was mapped as well.
*
*/
@Test
@Ignore
public void testNonMappedFieldsPermittedInDLTransaction() throws Exception {

final int numberOfRows = 4;
Expand Down Expand Up @@ -479,7 +481,7 @@ public void testNonMappedFieldsPermittedInDLTransaction() throws Exception {
* @expectedResults Assert that all the records were inserted and that the constant value was mapped as well.
*
*/
@Test
@Ignore
public void testHtmlFormattingInInsert() throws Exception {
_doTestHtmlFormattingInInsert(true);
_doTestHtmlFormattingInInsert(false);
Expand Down Expand Up @@ -575,7 +577,7 @@ private void _doTestHtmlFormattingInInsert(boolean preserveWhitespaceInRichText)
* @expectedResults Assert that the dates in Salesforce match up.
*
*/
@Test
@Ignore
public void testTimezoneNotTruncated() throws Exception {

final int numberOfRows = 12;
Expand Down Expand Up @@ -615,7 +617,7 @@ public void testTimezoneNotTruncated() throws Exception {
*
* @throws Exception
*/
@Test
@Ignore
public void testErrorsGeneratedOnInvalidDateMatching() throws Exception {

runTestErrorsGeneratedOnInvalidDateMatchWithOffset(0, 3,3);
Expand All @@ -628,12 +630,12 @@ public void testErrorsGeneratedOnInvalidDateMatching() throws Exception {
*
* @throws Exception
*/
@Test
@Ignore
public void testErrorsGeneratedOnInvalidDateMatchingWithOffset() throws Exception {
runTestErrorsGeneratedOnInvalidDateMatchWithOffset(2, 2, 2);
}

@Test
@Ignore
public void testOneToManySforceFieldsMappingInCsv() throws Exception {
// The use case is as follows:
// This company in this scenario only does business in the state of CA, therefore billing and shipping
Expand Down Expand Up @@ -666,7 +668,7 @@ public void testOneToManySforceFieldsMappingInCsv() throws Exception {
}
}

@Test
@Ignore
public void testEmptyFirstRowFieldValueInCsv() throws Exception {
Map<String, String> argumentMap = getUpdateTestConfig(false, null, 2);
if (isSettingEnabled(argumentMap, Config.BULK_API_ZIP_CONTENT)
Expand Down
Loading