Skip to content

Commit

Permalink
fix(Meta): Fix meta call to work with latest Rest SDK (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndickerson authored Oct 21, 2020
1 parent 65bfdcf commit 0824f88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dataloader.iml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
<orderEntry type="library" name="Maven: net.sourceforge.javacsv:javacsv:2.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-core:2.13.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.13.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.10.19" level="project" />
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.bullhornsdk.data.model.entity.meta.Field;
import com.bullhornsdk.data.model.entity.meta.MetaData;
import com.bullhornsdk.data.model.enums.MetaParameter;
import com.google.common.collect.Sets;

import org.json.JSONArray;
import org.json.JSONObject;

Expand Down Expand Up @@ -41,7 +43,7 @@ public void run(String[] args) {

try {
printUtil.log("Getting meta for " + Objects.requireNonNull(entityInfo).getEntityName() + "...");
MetaData<?> metaData = restApi.getMetaData(entityInfo.getEntityClass(), MetaParameter.FULL, null);
MetaData<?> metaData = restApi.getMetaData(entityInfo.getEntityClass(), MetaParameter.FULL, Sets.newHashSet(StringConsts.ALL_FIELDS));
enrichMeta(metaData);
JSONObject jsonMeta = metaToJson(metaData);
printUtil.print(jsonMeta.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import com.bullhorn.dataloader.rest.RestApi;
import com.bullhorn.dataloader.rest.RestSession;
import com.bullhorn.dataloader.util.PrintUtil;
import com.bullhorn.dataloader.util.StringConsts;
import com.bullhornsdk.data.exception.RestApiException;
import com.bullhornsdk.data.model.entity.core.standard.Candidate;
import com.bullhornsdk.data.model.entity.core.standard.CorporateUser;
import com.bullhornsdk.data.model.entity.meta.Field;
import com.bullhornsdk.data.model.entity.meta.StandardMetaData;
import com.bullhornsdk.data.model.enums.MetaParameter;
import com.google.common.collect.Sets;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.Assert;
Expand All @@ -23,6 +25,7 @@
import java.util.Arrays;

import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -71,7 +74,8 @@ public void setup() {
candidateMeta.setFields(new ArrayList<>(Arrays.asList(idField, emailField, commentsField, customTextField, customIntField, ownerField, addressField)));

when(restSessionMock.getRestApi()).thenReturn(restApiMock);
when(restApiMock.getMetaData(Candidate.class, MetaParameter.FULL, null)).thenReturn(candidateMeta);
when(restApiMock.getMetaData(eq(Candidate.class), eq(MetaParameter.FULL), eq(Sets.newHashSet(StringConsts.ALL_FIELDS))))
.thenReturn(candidateMeta);
}

@Test
Expand Down Expand Up @@ -128,7 +132,7 @@ public void testRunBadConnection() {

@Test
public void testRunMetaCallException() {
when(restApiMock.getMetaData(Candidate.class, MetaParameter.FULL, null))
when(restApiMock.getMetaData(eq(Candidate.class), eq(MetaParameter.FULL), eq(Sets.newHashSet(StringConsts.ALL_FIELDS))))
.thenThrow(new RestApiException("Meta Error"));

metaService.run(new String[]{Command.META.getMethodName(), "Candidate"});
Expand Down

0 comments on commit 0824f88

Please sign in to comment.