Skip to content

Commit

Permalink
Get rid of FragmentPersisterBuilder as a return value to avoid releas…
Browse files Browse the repository at this point in the history
…ing issues
  • Loading branch information
muttcg committed Dec 16, 2024
1 parent b78f789 commit 9d5b3c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import org.gbif.pipelines.fragmenter.common.HbaseStore;
import org.gbif.pipelines.fragmenter.common.RawRecord;
import org.gbif.pipelines.fragmenter.record.OccurrenceRecordConverter;
import org.gbif.pipelines.fragmenter.strategy.DwcaStrategy;
import org.gbif.pipelines.fragmenter.strategy.Strategy;
import org.gbif.pipelines.fragmenter.strategy.XmlStrategy;
import org.gbif.pipelines.keygen.HBaseLockingKeyService;
import org.gbif.pipelines.keygen.OccurrenceRecord;
import org.gbif.pipelines.keygen.common.HbaseConnectionFactory;
Expand Down Expand Up @@ -92,14 +90,6 @@ public class FragmentPersister {

private Connection hbaseConnection;

public static FragmentPersisterBuilder xmlBuilder() {
return FragmentPersister.builder().strategy(XmlStrategy.create());
}

public static FragmentPersisterBuilder dwcaBuilder() {
return FragmentPersister.builder().strategy(DwcaStrategy.create());
}

@SneakyThrows
public long persist() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.gbif.api.vocabulary.EndpointType;
import org.gbif.pipelines.fragmenter.common.HbaseServer;
import org.gbif.pipelines.fragmenter.common.TableAssert;
import org.gbif.pipelines.fragmenter.strategy.DwcaStrategy;
import org.gbif.pipelines.fragmenter.strategy.XmlStrategy;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
Expand Down Expand Up @@ -47,7 +49,8 @@ public void dwcaDwcaZipSyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularZipDwca)
Expand Down Expand Up @@ -77,7 +80,8 @@ public void dwcaSyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularDwca)
Expand Down Expand Up @@ -107,7 +111,8 @@ public void dwcaAsyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularDwca)
Expand Down Expand Up @@ -140,7 +145,8 @@ public void dwcaSyncUpdateUploadTest() throws IOException {

// When
long resultFirst =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularDwca)
Expand All @@ -156,7 +162,8 @@ public void dwcaSyncUpdateUploadTest() throws IOException {
.persist();

long resultSecond =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularUpdatedDwca)
Expand Down Expand Up @@ -193,7 +200,8 @@ public void dwcaAsyncUpdateUploadTest() throws IOException {

// When
long resultFirst =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularDwca)
Expand All @@ -210,7 +218,8 @@ public void dwcaAsyncUpdateUploadTest() throws IOException {
.persist();

long resultSecond =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(regularUpdatedDwca)
Expand Down Expand Up @@ -248,7 +257,8 @@ public void dwcaOccExtSyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(occurrenceAsExtensionDwca)
Expand Down Expand Up @@ -278,7 +288,8 @@ public void dwcaOccExtAsyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(occurrenceAsExtensionDwca)
Expand Down Expand Up @@ -310,7 +321,8 @@ public void dwcaMultimediaSyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(multimediaExtensionDwca)
Expand Down Expand Up @@ -340,7 +352,8 @@ public void dwcaMultimediaAsyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.dwcaBuilder()
FragmentPersister.builder()
.strategy(DwcaStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(multimediaExtensionDwca)
Expand Down Expand Up @@ -373,7 +386,8 @@ public void xmlSyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand Down Expand Up @@ -403,7 +417,8 @@ public void xmlAsyncUploadTest() throws IOException {

// When
long result =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand Down Expand Up @@ -435,7 +450,8 @@ public void xmlSyncDoubeUploadTest() throws IOException {

// When
long resultFirst =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand All @@ -451,7 +467,8 @@ public void xmlSyncDoubeUploadTest() throws IOException {
.persist();

long resultSecond =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand Down Expand Up @@ -488,7 +505,8 @@ public void xmlAsyncDoubeUploadTest() throws IOException {

// When
long resultFirst =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand All @@ -505,7 +523,8 @@ public void xmlAsyncDoubeUploadTest() throws IOException {
.persist();

long resultSecond =
FragmentPersister.xmlBuilder()
FragmentPersister.builder()
.strategy(XmlStrategy.create())
.tableName(HbaseServer.FRAGMENT_TABLE_NAME)
.keygenConfig(HbaseServer.CFG)
.pathToArchive(xmlArchivePath)
Expand Down

0 comments on commit 9d5b3c8

Please sign in to comment.