| Chunk |
|---|
| Conflicting content |
|---|
import org.sagebionetworks.repo.model.Study; import org.sagebionetworks.repo.model.TermsOfUseAccessApproval; import org.sagebionetworks.repo.model.TermsOfUseAccessRequirement; <<<<<<< HEAD import org.sagebionetworks.repo.model.auth.UserEntityPermissions; import org.sagebionetworks.repo.web.NotFoundException; ======= import org.sagebionetworks.repo.model.versionInfo.VersionInfo; >>>>>>> 9b6ca7b6389a1cfef2a22ec818c65dbd485be3d0 import org.sagebionetworks.schema.adapter.JSONObjectAdapter; import org.sagebionetworks.schema.adapter.JSONObjectAdapterException; import org.sagebionetworks.schema.adapter.org.json.EntityFactory; |
| Solution content |
|---|
import org.sagebionetworks.repo.model.Study; import org.sagebionetworks.repo.model.TermsOfUseAccessApproval; import org.sagebionetworks.repo.model.TermsOfUseAccessRequirement; import org.sagebionetworks.repo.model.auth.UserEntityPermissions; import org.sagebionetworks.repo.web.NotFoundException; import org.sagebionetworks.repo.model.versionInfo.VersionInfo; import org.sagebionetworks.schema.adapter.JSONObjectAdapter; import org.sagebionetworks.schema.adapter.JSONObjectAdapterException; import org.sagebionetworks.schema.adapter.org.json.EntityFactory; |
| File |
|---|
| SynapseTest.java |
| Developer's decision |
|---|
| Concatenation |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
}
@Test
<<<<<<< HEAD
public void testGetEntityBundle() throws NameConflictException, JSONObjectAdapterException, ServletException, IOException, NotFoundException, DatastoreException, SynapseException {
// Create an entity
Study s = EntityCreator.createNewDataset();
// Get/add/update annotations for this entity
Annotations a = new Annotations();
a.setEtag(s.getEtag());
a.addAnnotation("doubleAnno", new Double(45.0001));
a.addAnnotation("string", "A string");
JSONObjectAdapter adapter0 = new JSONObjectAdapterImpl();
a.writeToJSONObject(adapter0);
// We want the mock response to return JSON
StringEntity response = new StringEntity(adapter0.toJSONString());
when(mockResponse.getEntity()).thenReturn(response);
synapse.updateAnnotations(s.getId(), a);
// Assemble the bundle
EntityBundle eb = new EntityBundle();
eb.setEntity(s);
eb.setAnnotations(a);
JSONObjectAdapter adapter = new JSONObjectAdapterImpl();
eb.writeToJSONObject(adapter);
// We want the mock response to return JSON
StringEntity responseEntity = new StringEntity(adapter.toJSONString());
when(mockResponse.getEntity()).thenReturn(responseEntity);
// Get the bundle, verify contents
int mask = EntityBundle.ENTITY + EntityBundle.ANNOTATIONS;
EntityBundle eb2 = synapse.getEntityBundle(s.getId(), mask);
Study s2 = (Study) eb2.getEntity();
assertEquals("Retrieved Entity in bundle does not match original one", s, s2);
Annotations a2 = eb2.getAnnotations();
assertEquals("Retrieved Annotations in bundle do not match original ones", a, a2);
UserEntityPermissions uep = eb2.getPermissions();
assertNull("Permissions were not requested, but were returned in bundle", uep);
EntityPath path = eb2.getPath();
assertNull("Path was not requested, but was returned in bundle", path);
}
=======
public void testGetVersionInfo() throws Exception {
VersionInfo expectedVersion = new VersionInfo();
expectedVersion.setVersion("versionString");
String jsonString = EntityFactory.createJSONStringForEntity(expectedVersion);
StringEntity responseEntity = new StringEntity(jsonString);
when(mockResponse.getEntity()).thenReturn(responseEntity);
VersionInfo vi = synapse.getVersionInfo();
assertNotNull(vi);
assertEquals(vi, expectedVersion);
};
>>>>>>> 9b6ca7b6389a1cfef2a22ec818c65dbd485be3d0
} |
| Solution content |
|---|
}
@Test
public void testGetEntityBundle() throws NameConflictException, JSONObjectAdapterException, ServletException, IOException, NotFoundException, DatastoreException, SynapseException {
// Create an entity
Study s = EntityCreator.createNewDataset();
// Get/add/update annotations for this entity
Annotations a = new Annotations();
a.setEtag(s.getEtag());
a.addAnnotation("doubleAnno", new Double(45.0001));
a.addAnnotation("string", "A string");
JSONObjectAdapter adapter0 = new JSONObjectAdapterImpl();
a.writeToJSONObject(adapter0);
// We want the mock response to return JSON
StringEntity response = new StringEntity(adapter0.toJSONString());
when(mockResponse.getEntity()).thenReturn(response);
synapse.updateAnnotations(s.getId(), a);
// Assemble the bundle
EntityBundle eb = new EntityBundle();
eb.setEntity(s);
eb.setAnnotations(a);
JSONObjectAdapter adapter = new JSONObjectAdapterImpl();
eb.writeToJSONObject(adapter);
// We want the mock response to return JSON
StringEntity responseEntity = new StringEntity(adapter.toJSONString());
when(mockResponse.getEntity()).thenReturn(responseEntity);
// Get the bundle, verify contents
int mask = EntityBundle.ENTITY + EntityBundle.ANNOTATIONS;
EntityBundle eb2 = synapse.getEntityBundle(s.getId(), mask);
Study s2 = (Study) eb2.getEntity();
assertEquals("Retrieved Entity in bundle does not match original one", s, s2);
Annotations a2 = eb2.getAnnotations();
assertEquals("Retrieved Annotations in bundle do not match original ones", a, a2);
UserEntityPermissions uep = eb2.getPermissions();
assertNull("Permissions were not requested, but were returned in bundle", uep);
EntityPath path = eb2.getPath();
assertNull("Path was not requested, but was returned in bundle", path);
}
@Test
public void testGetVersionInfo() throws Exception {
VersionInfo expectedVersion = new VersionInfo();
expectedVersion.setVersion("versionString");
String jsonString = EntityFactory.createJSONStringForEntity(expectedVersion);
StringEntity responseEntity = new StringEntity(jsonString);
when(mockResponse.getEntity()).thenReturn(responseEntity);
VersionInfo vi = synapse.getVersionInfo();
assertNotNull(vi);
assertEquals(vi, expectedVersion);
};
} |
| File |
|---|
| SynapseTest.java |
| Developer's decision |
|---|
| Concatenation |
| Kind of conflict |
|---|
| Method declaration |
| Chunk |
|---|
| Conflicting content |
|---|
import org.codehaus.jackson.map.JsonMappingException; import org.json.JSONException; import org.json.JSONObject; <<<<<<< HEAD ======= import org.sagebionetworks.repo.model.ServiceConstants; import org.sagebionetworks.repo.model.ServiceConstants.AttachmentType; >>>>>>> 9b6ca7b6389a1cfef2a22ec818c65dbd485be3d0 import org.sagebionetworks.repo.manager.TestUserDAO; import org.sagebionetworks.repo.manager.UserManager; import org.sagebionetworks.repo.model.ACLInheritanceException; |
| Solution content |
|---|
import org.codehaus.jackson.map.JsonMappingException; import org.json.JSONException; import org.json.JSONObject; //import org.sagebionetworks.repo.model.ServiceConstants; //import org.sagebionetworks.repo.model.ServiceConstants.AttachmentType; import org.sagebionetworks.repo.manager.TestUserDAO; import org.sagebionetworks.repo.manager.UserManager; import org.sagebionetworks.repo.model.ACLInheritanceException; |
| File |
|---|
| ServletTestHelper.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
import org.sagebionetworks.repo.model.ontology.ConceptResponsePage; import org.sagebionetworks.repo.model.search.SearchResults; import org.sagebionetworks.repo.model.status.StackStatus; <<<<<<< HEAD ======= import org.sagebionetworks.repo.model.versionInfo.VersionInfo; import org.sagebionetworks.repo.web.GenericEntityController; >>>>>>> 9b6ca7b6389a1cfef2a22ec818c65dbd485be3d0 import org.sagebionetworks.repo.web.NotFoundException; import org.sagebionetworks.repo.web.UrlHelpers; import org.sagebionetworks.repo.web.service.EntityService; |
| Solution content |
|---|
import org.sagebionetworks.repo.model.ontology.ConceptResponsePage; import org.sagebionetworks.repo.model.search.SearchResults; import org.sagebionetworks.repo.model.status.StackStatus; import org.sagebionetworks.repo.model.versionInfo.VersionInfo; import org.sagebionetworks.repo.web.NotFoundException; import org.sagebionetworks.repo.web.UrlHelpers; import org.sagebionetworks.repo.web.service.EntityService; |
| File |
|---|
| ServletTestHelper.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
} } <<<<<<< HEAD public static PaginatedResults |
| Solution content |
|---|
} } public static PaginatedResults |
| File |
|---|
| ServletTestHelper.java |
| Developer's decision |
|---|
| Manual |
| Kind of conflict |
|---|
| Method signature |
| Variable |
| Chunk |
|---|
| Conflicting content |
|---|
if (response.getStatus() != HttpStatus.OK.value()) {
MockHttpServletResponse response = new MockHttpServletResponse();
request.setMethod("GET");
request.addHeader("Accept", "application/json");
<<<<<<< HEAD
request.setRequestURI(UrlHelpers.GET_ALL_BACKUP_OBJECTS);
request.setParameter(AuthorizationConstants.USER_ID_PARAM, userId);
request.setParameter(ServiceConstants.PAGINATION_OFFSET_PARAM, ""+offset);
request.setParameter(ServiceConstants.PAGINATION_LIMIT_PARAM, ""+limit);
dispatchServlet.service(request, response);
log.debug("Results: " + response.getContentAsString());
throw new ServletTestHelperException(response);
}
return createPaginatedResultsFromJSON(response.getContentAsString(),
MigratableObjectData.class);
}
=======
request.setRequestURI(UrlHelpers.VERSIONINFO);
System.out.println(request.getRequestURL());
dispatchServlet.service(request, response);
if (response.getStatus() != HttpStatus.OK.value()) {
throw new ServletTestHelperException(response);
}
vi = (VersionInfo) objectMapper.readValue(
response.getContentAsString(), VersionInfo.class);
return vi;
}
>>>>>>> 9b6ca7b6389a1cfef2a22ec818c65dbd485be3d0
} |
| Solution content |
|---|
MockHttpServletResponse response = new MockHttpServletResponse();
request.setMethod("GET");
request.addHeader("Accept", "application/json");
request.setRequestURI(UrlHelpers.VERSIONINFO);
System.out.println(request.getRequestURL());
dispatchServlet.service(request, response);
if (response.getStatus() != HttpStatus.OK.value()) {
throw new ServletTestHelperException(response);
}
vi = (VersionInfo) objectMapper.readValue(
response.getContentAsString(), VersionInfo.class);
return vi;
}
} |
| File |
|---|
| ServletTestHelper.java |
| Developer's decision |
|---|
| Version 2 |
| Kind of conflict |
|---|
| Cast expression |
| If statement |
| Method invocation |
| Return statement |
| Variable |