conflict_resolution
stringlengths 27
16k
|
---|
<<<<<<<
import org.qi4j.api.query.grammar.ContainsAllPredicate;
import org.qi4j.api.query.grammar.ContainsPredicate;
import java.util.Collection;
=======
>>>>>>>
import org.qi4j.api.query.grammar.ContainsAllPredicate;
import org.qi4j.api.query.grammar.ContainsPredicate;
import java.util.Collection; |
<<<<<<<
import java.lang.reflect.Type;
=======
>>>>>>>
import java.lang.reflect.Type;
<<<<<<<
import static org.qi4j.api.common.TypeName.*;
import org.qi4j.api.structure.Module;
=======
import static org.qi4j.api.common.TypeName.*;
import org.qi4j.api.structure.Module;
import java.lang.reflect.Type;
>>>>>>>
import org.qi4j.api.structure.Module;
import static org.qi4j.api.common.TypeName.*; |
<<<<<<<
=======
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.embulk.EmbulkSystemProperties;
>>>>>>>
import java.util.Set;
import org.embulk.EmbulkSystemProperties;
<<<<<<<
import org.embulk.spi.time.Instants;
=======
import org.embulk.plugin.maven.MavenPluginSource;
>>>>>>>
import org.embulk.plugin.maven.MavenPluginSource;
import org.embulk.spi.time.Instants; |
<<<<<<<
import org.embulk.config.TaskReport;
import org.embulk.plugin.PluginType;
=======
import org.embulk.config.CommitReport;
>>>>>>>
import org.embulk.config.TaskReport; |
<<<<<<<
import org.unidal.cat.plugin.transaction.filter.TransactionHolder;
import org.unidal.cat.plugin.transaction.filter.TransactionReportHelper;
import org.unidal.lookup.annotation.Named;
import com.dianping.cat.consumer.transaction.model.entity.Machine;
import com.dianping.cat.consumer.transaction.model.entity.TransactionName;
import com.dianping.cat.consumer.transaction.model.entity.TransactionReport;
import com.dianping.cat.consumer.transaction.model.entity.TransactionType;
=======
import com.dianping.cat.consumer.transaction.model.entity.*;
>>>>>>>
import com.dianping.cat.consumer.transaction.model.entity.*;
<<<<<<<
=======
import org.unidal.cat.plugin.transaction.filter.TransactionHolder;
import org.unidal.cat.plugin.transaction.filter.TransactionReportHelper;
import org.unidal.lookup.annotation.Named;
>>>>>>>
import org.unidal.cat.plugin.transaction.filter.TransactionHolder;
import org.unidal.cat.plugin.transaction.filter.TransactionReportHelper;
import org.unidal.lookup.annotation.Named; |
<<<<<<<
import org.incode.module.base.dom.valuetypes.LocalDateInterval;
=======
import org.incode.module.base.dom.managed.ManagedIn;
>>>>>>>
import org.incode.module.base.dom.managed.ManagedIn;
import org.incode.module.base.dom.valuetypes.LocalDateInterval;
<<<<<<<
import org.estatio.module.lease.dom.Lease;
import org.estatio.module.lease.dom.LeaseRepository;
import org.estatio.module.lease.dom.occupancy.Occupancy;
=======
import org.estatio.module.lease.dom.Lease;
import org.estatio.module.lease.dom.LeaseItem;
import org.estatio.module.lease.dom.LeaseItemType;
import org.estatio.module.lease.dom.LeaseRepository;
>>>>>>> |
<<<<<<<
import org.apache.isis.applib.services.eventbus.EventBusService;
=======
>>>>>>> |
<<<<<<<
import org.incode.module.base.dom.managed.ManagedIn;
=======
import org.incode.module.country.dom.impl.Country;
>>>>>>>
import org.incode.module.base.dom.managed.ManagedIn;
import org.incode.module.country.dom.impl.Country;
<<<<<<<
import org.estatio.module.lease.dom.Lease;
import org.estatio.module.lease.dom.LeaseItem;
import org.estatio.module.lease.dom.LeaseItemType;
import org.estatio.module.lease.dom.LeaseRepository;
=======
import org.estatio.module.countryapptenancy.dom.CountryServiceForCurrentUser;
import org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry;
import org.estatio.module.lease.dom.LeaseAgreementRoleTypeEnum;
>>>>>>>
import org.estatio.module.lease.dom.Lease;
import org.estatio.module.lease.dom.LeaseItem;
import org.estatio.module.lease.dom.LeaseItemType;
import org.estatio.module.lease.dom.LeaseRepository;
import org.estatio.module.countryapptenancy.dom.CountryServiceForCurrentUser;
import org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry;
import org.estatio.module.lease.dom.LeaseAgreementRoleTypeEnum;
<<<<<<<
@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
public void repairTurnoverRentTermsSwe(){
final List<Lease> leasesSwe = leaseRepository.allLeases().stream()
.filter(l -> l.getManagedIn() == ManagedIn.FASTNET)
.collect(Collectors.toList());
leasesSwe.forEach(l->{
final List<LeaseItem> torItems = l.findItemsOfType(LeaseItemType.TURNOVER_RENT);
try {
torItems.forEach(li -> wrapperFactory.wrap(li).repairTurnoverRentTermsSwe());
} catch (Exception e){
System.out.println(String.format("Problem repairing turnover rent terms for %s", l.getReference()));
}
});
}
=======
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-wrench")
@MemberOrder(sequence = "98")
public MissingChamberOfCommerceCodeManager fixMissingChamberOfCommerceCodes(
final Country country,
final IPartyRoleType role,
final @ParameterLayout(named = "Start from bottom?") boolean reversed) {
final ApplicationTenancy applicationTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(country);
List<Organisation> organisationsMissingCode = organisationRepository.findByAtPathMissingChamberOfCommerceCode(applicationTenancy.getPath())
.stream()
.filter(org -> org.hasPartyRoleType(role))
.collect(Collectors.collectingAndThen(
Collectors.toList(), lst -> {
if (reversed)
Collections.reverse(lst);
return lst;
}
));
return new MissingChamberOfCommerceCodeManager(organisationsMissingCode);
}
public List<Country> choices0FixMissingChamberOfCommerceCodes() {
return countryServiceForCurrentUser.countriesForCurrentUser();
}
public List<PartyRoleType> choices1FixMissingChamberOfCommerceCodes() {
return Arrays.asList(
partyRoleTypeRepository.findByKey(LeaseAgreementRoleTypeEnum.TENANT.getKey()),
partyRoleTypeRepository.findByKey(IncomingInvoiceRoleTypeEnum.SUPPLIER.getKey())
);
}
@Action(restrictTo = RestrictTo.PROTOTYPING)
public void fixUpTransitionsForAllIncomingInvoices() {
final List<IncomingInvoice> incomingInvoices = incomingInvoiceRepository.listAll();
for (IncomingInvoice incomingInvoice : incomingInvoices) {
stateTransitionService.trigger(incomingInvoice, IncomingInvoiceApprovalStateTransition.class, null, null, null);
}
}
// //////////////////////////////////////
>>>>>>>
@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
public void repairTurnoverRentTermsSwe(){
final List<Lease> leasesSwe = leaseRepository.allLeases().stream()
.filter(l -> l.getManagedIn() == ManagedIn.FASTNET)
.collect(Collectors.toList());
leasesSwe.forEach(l->{
final List<LeaseItem> torItems = l.findItemsOfType(LeaseItemType.TURNOVER_RENT);
try {
torItems.forEach(li -> wrapperFactory.wrap(li).repairTurnoverRentTermsSwe());
} catch (Exception e){
System.out.println(String.format("Problem repairing turnover rent terms for %s", l.getReference()));
}
});
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa = "fa-wrench")
@MemberOrder(sequence = "98")
public MissingChamberOfCommerceCodeManager fixMissingChamberOfCommerceCodes(
final Country country,
final IPartyRoleType role,
final @ParameterLayout(named = "Start from bottom?") boolean reversed) {
final ApplicationTenancy applicationTenancy = estatioApplicationTenancyRepository.findOrCreateTenancyFor(country);
List<Organisation> organisationsMissingCode = organisationRepository.findByAtPathMissingChamberOfCommerceCode(applicationTenancy.getPath())
.stream()
.filter(org -> org.hasPartyRoleType(role))
.collect(Collectors.collectingAndThen(
Collectors.toList(), lst -> {
if (reversed)
Collections.reverse(lst);
return lst;
}
));
return new MissingChamberOfCommerceCodeManager(organisationsMissingCode);
}
public List<Country> choices0FixMissingChamberOfCommerceCodes() {
return countryServiceForCurrentUser.countriesForCurrentUser();
}
public List<PartyRoleType> choices1FixMissingChamberOfCommerceCodes() {
return Arrays.asList(
partyRoleTypeRepository.findByKey(LeaseAgreementRoleTypeEnum.TENANT.getKey()),
partyRoleTypeRepository.findByKey(IncomingInvoiceRoleTypeEnum.SUPPLIER.getKey())
);
}
@Action(restrictTo = RestrictTo.PROTOTYPING)
public void fixUpTransitionsForAllIncomingInvoices() {
final List<IncomingInvoice> incomingInvoices = incomingInvoiceRepository.listAll();
for (IncomingInvoice incomingInvoice : incomingInvoices) {
stateTransitionService.trigger(incomingInvoice, IncomingInvoiceApprovalStateTransition.class, null, null, null);
}
}
// //////////////////////////////////////
<<<<<<<
@Inject LeaseRepository leaseRepository;
=======
@Inject
OrganisationRepository organisationRepository;
@Inject
CountryServiceForCurrentUser countryServiceForCurrentUser;
@Inject
EstatioApplicationTenancyRepositoryForCountry estatioApplicationTenancyRepository;
@Inject
PartyRoleTypeRepository partyRoleTypeRepository;
@Inject
StateTransitionService stateTransitionService;
>>>>>>>
@Inject
LeaseRepository leaseRepository;
@Inject
OrganisationRepository organisationRepository;
@Inject
CountryServiceForCurrentUser countryServiceForCurrentUser;
@Inject
EstatioApplicationTenancyRepositoryForCountry estatioApplicationTenancyRepository;
@Inject
PartyRoleTypeRepository partyRoleTypeRepository;
@Inject
StateTransitionService stateTransitionService; |
<<<<<<<
@Indices({
@Index(name = "CodaDocLine_accountCodeValidation_IDX",
members = { "handling", "accountCodeValidationStatus", "accountCode" }),
@Index(name = "CodaDocLine_accountCodeEl3Validation_IDX",
members = { "handling", "accountCodeValidationStatus", "accountCodeEl3ValidationStatus", "accountCodeEl3" }),
@Index(name = "CodaDocLine_accountCodeEl5Validation_IDX",
members = { "handling", "accountCodeValidationStatus", "accountCodeEl5ValidationStatus", "accountCodeEl5" }),
@Index(name = "CodaDocLine_accountCodeEl6Validation_IDX",
members = { "handling", "accountCodeValidationStatus", "accountCodeEl6ValidationStatus", "accountCodeEl6" }),
@Index(name = "CodaDocLine_supplierBankAccountValidation_IDX",
members = { "handling", "accountCodeValidationStatus", "supplierBankAccountValidationStatus", "elmBankAccount" }),
@Index(name = "CodaDocLine_extRefValidation_IDX",
members = { "handling", "extRefValidationStatus", "extRef3", "extRef5" }),
@Index(name = "CodaDocLine_orderValidation_IDX",
members = { "handling", "extRefValidationStatus", "extRefOrderValidationStatus", "orderNumber" }),
@Index(name = "CodaDocLine_projectValidation_IDX",
members = { "handling", "extRefValidationStatus", "extRefProjectValidationStatus", "projectReference" }),
@Index(name = "CodaDocLine_workTypeValidation_IDX",
members = { "handling", "extRefValidationStatus", "extRefWorkTypeValidationStatus", "chargeReference" }),
@Index(name = "CodaDocLine_mediaCodeValidation_IDX",
members = { "handling", "mediaCodeValidationStatus", "mediaCode" }),
})
=======
>>>>>>> |
<<<<<<<
=======
import org.apache.isis.applib.services.eventbus.EventBusService;
>>>>>>>
<<<<<<<
final String atPath) throws IllegalArgumentException {
=======
final String atPath) throws IllegalArgumentException {
>>>>>>>
final String atPath) throws IllegalArgumentException {
<<<<<<<
switch (documentTypeData) {
case INCOMING:
return incomingDocumentRepository.upsertAndArchive(type, documentBarcodeService.deriveAtPathFromBarcode(name), name, blob);
case TAX_REGISTER:
return incomingDocumentRepository.upsertAndArchive(type, atPath, name, blob);
=======
switch (documentTypeData) {
case INCOMING:
final String overridden = documentBarcodeService.deriveAtPathFromBarcode(name);
return incomingDocumentRepository.upsertAndArchive(type, overridden != null ? overridden : atPath, name, blob);
case TAX_REGISTER:
return incomingDocumentRepository.upsertAndArchive(type, atPath, name, blob);
>>>>>>>
switch (documentTypeData) {
case INCOMING:
final String overridden = documentBarcodeService.deriveAtPathFromBarcode(name);
return incomingDocumentRepository.upsertAndArchive(type, overridden != null ? overridden : atPath, name, blob);
case TAX_REGISTER:
return incomingDocumentRepository.upsertAndArchive(type, atPath, name, blob); |
<<<<<<<
import com.google.gwt.event.dom.client.*;
import com.google.gwt.event.shared.HandlerRegistration;
import gwt.material.design.client.base.ComplexWidget;
=======
>>>>>>>
import com.google.gwt.event.dom.client.*;
import com.google.gwt.event.shared.HandlerRegistration;
<<<<<<<
public class MaterialColumn extends ComplexWidget implements HasWaves, HasVisibility, HasClickHandlers, HasAllMouseHandlers, HasDoubleClickHandlers {
=======
public class MaterialColumn extends MaterialWidget implements HasWaves, HasVisibility {
>>>>>>>
public class MaterialColumn extends MaterialWidget implements HasWaves, HasVisibility, HasClickHandlers,
HasAllMouseHandlers, HasDoubleClickHandlers { |
<<<<<<<
public void testAllowBlanks() {
// given
MaterialListValueBox<Integer> valueBox = (MaterialListValueBox<Integer>) getWidget();
assertFalse(valueBox.isAllowBlank());
assertEquals(0, valueBox.getItemCount());
// when / then
valueBox.setAllowBlank(true);
assertEquals(1, valueBox.getItemCount());
valueBox.addItem(Integer.valueOf(1));
assertEquals(2, valueBox.getItemCount());
valueBox.addItem(Integer.valueOf(2));
valueBox.addItem(Integer.valueOf(3));
assertTrue(valueBox.isAllowBlank());
valueBox.setSelectedIndex(-1);
assertNull(valueBox.getSelectedValue());
assertNull(valueBox.getValue());
valueBox.setValue(null);
assertEquals(0, valueBox.getSelectedIndex());
assertNull(valueBox.getValue());
valueBox.setValue(Integer.valueOf(2));
assertEquals(2, valueBox.getSelectedIndex());
assertNotNull(valueBox.getValue());
valueBox.setValue(null);
assertEquals(0, valueBox.getSelectedIndex());
assertNull(valueBox.getValue());
valueBox.setAllowBlank(false);
assertEquals(0, valueBox.getSelectedIndex());
assertNotNull(valueBox.getValue());
valueBox.setAllowBlank(true);
valueBox.setValue(null);
assertNull(valueBox.getValue());
}
=======
public void testFocusAndBlurHandlers() {
MaterialListValueBox<T> valueBox = getWidget();
checkFocusAndBlurEvents(valueBox);
}
public void testEmptyPlaceHolder() {
// Given
final String EMPTY_PLACEHOLDER = "select-item";
MaterialListValueBox<Integer> valueBox = new MaterialListValueBox<>();
for (int i = 0; i <= 10; i++) {
valueBox.addItem(i, "Item " + i);
}
RootPanel.get().add(valueBox);
// when / then
valueBox.setEmptyPlaceHolder(EMPTY_PLACEHOLDER);
assertEquals(EMPTY_PLACEHOLDER, valueBox.getEmptyPlaceHolder());
assertEquals(valueBox.getListBox().getItemText(0), EMPTY_PLACEHOLDER);
assertTrue(valueBox.getOptionElement(0).isDisabled());
valueBox.setEmptyPlaceHolder(null);
assertNotSame(EMPTY_PLACEHOLDER, valueBox.getEmptyPlaceHolder());
assertNotSame(EMPTY_PLACEHOLDER, valueBox.getOptionElement(0));
assertNotNull(valueBox.getValue());
}
>>>>>>>
public void testAllowBlanks() {
// given
MaterialListValueBox<Integer> valueBox = (MaterialListValueBox<Integer>) getWidget();
assertFalse(valueBox.isAllowBlank());
assertEquals(0, valueBox.getItemCount());
// when / then
valueBox.setAllowBlank(true);
assertEquals(1, valueBox.getItemCount());
valueBox.addItem(Integer.valueOf(1));
assertEquals(2, valueBox.getItemCount());
valueBox.addItem(Integer.valueOf(2));
valueBox.addItem(Integer.valueOf(3));
assertTrue(valueBox.isAllowBlank());
valueBox.setSelectedIndex(-1);
assertNull(valueBox.getSelectedValue());
assertNull(valueBox.getValue());
valueBox.setValue(null);
assertEquals(0, valueBox.getSelectedIndex());
assertNull(valueBox.getValue());
valueBox.setValue(Integer.valueOf(2));
assertEquals(2, valueBox.getSelectedIndex());
assertNotNull(valueBox.getValue());
valueBox.setValue(null);
assertEquals(0, valueBox.getSelectedIndex());
assertNull(valueBox.getValue());
valueBox.setAllowBlank(false);
assertEquals(0, valueBox.getSelectedIndex());
assertNotNull(valueBox.getValue());
valueBox.setAllowBlank(true);
valueBox.setValue(null);
assertNull(valueBox.getValue());
}
public void testFocusAndBlurHandlers() {
MaterialListValueBox<T> valueBox = getWidget();
checkFocusAndBlurEvents(valueBox);
}
public void testEmptyPlaceHolder() {
// Given
final String EMPTY_PLACEHOLDER = "select-item";
MaterialListValueBox<Integer> valueBox = new MaterialListValueBox<>();
for (int i = 0; i <= 10; i++) {
valueBox.addItem(i, "Item " + i);
}
RootPanel.get().add(valueBox);
// when / then
valueBox.setEmptyPlaceHolder(EMPTY_PLACEHOLDER);
assertEquals(EMPTY_PLACEHOLDER, valueBox.getEmptyPlaceHolder());
assertEquals(valueBox.getListBox().getItemText(0), EMPTY_PLACEHOLDER);
assertTrue(valueBox.getOptionElement(0).isDisabled());
valueBox.setEmptyPlaceHolder(null);
assertNotSame(EMPTY_PLACEHOLDER, valueBox.getEmptyPlaceHolder());
assertNotSame(EMPTY_PLACEHOLDER, valueBox.getOptionElement(0));
assertNotNull(valueBox.getValue());
} |
<<<<<<<
if (valueBoxBase.getText() != null && !valueBoxBase.getText().isEmpty()) {
label.addStyleName("active");
=======
if (this.valueBoxBase.getText() != null && !this.valueBoxBase.getText().isEmpty()) {
label.addStyleName(CssName.ACTIVE);
>>>>>>>
if (valueBoxBase.getText() != null && !valueBoxBase.getText().isEmpty()) {
label.addStyleName(CssName.ACTIVE); |
<<<<<<<
import org.wso2.msf4j.service.TestMicroServiceWithDynamicPath;
=======
import org.wso2.msf4j.service.SecondService;
>>>>>>>
import org.wso2.msf4j.service.SecondService;
import org.wso2.msf4j.service.TestMicroServiceWithDynamicPath;
<<<<<<<
microservicesRunner.deploy(new TestMicroServiceWithDynamicPath(), "/DynamicPath");
=======
secondMicroservicesRunner = new MicroservicesRunner(port + 1);
secondMicroservicesRunner.deploy(secondService).start();
>>>>>>>
microservicesRunner.deploy(new TestMicroServiceWithDynamicPath(), "/DynamicPath");
secondMicroservicesRunner = new MicroservicesRunner(port + 1);
secondMicroservicesRunner.deploy(secondService).start(); |
<<<<<<<
pipeline.addLast(eventExecutorGroup, "router",
new RequestRouter(MicroservicesRegistry.getInstance()
.getHttpResourceHandler(), 0));
pipeline.addLast(eventExecutorGroup, "dispatcher", new HttpDispatcher());
=======
pipeline.addLast("compressor", new HttpContentCompressor());
pipeline.addLast(eventExecutorGroup, "router",
new RequestRouter(microservicesRegistry.getHttpResourceHandler(), 0));
//TODO: remove
// limit
//TODO: see what can be done
/*if (pipelineModifier != null) {
pipelineModifier.apply(pipeline);
}*/
>>>>>>>
pipeline.addLast(eventExecutorGroup, "router",
new RequestRouter(microservicesRegistry.getHttpResourceHandler(), 0));
pipeline.addLast(eventExecutorGroup, "dispatcher", new HttpDispatcher()); |
<<<<<<<
import org.wso2.msf4j.service.TestMicroServiceWithDynamicPath;
=======
import org.wso2.msf4j.service.SecondService;
>>>>>>>
import org.wso2.msf4j.service.SecondService;
import org.wso2.msf4j.service.TestMicroServiceWithDynamicPath;
<<<<<<<
microservicesRunner
.addExceptionMapper(new TestExceptionMapper(), new TestExceptionMapper2())
.deploy(testMicroservice)
.start();
microservicesRunner.deploy(new TestMicroServiceWithDynamicPath(), "/DynamicPath");
=======
microservicesRunner.addExceptionMapper(new TestExceptionMapper(), new TestExceptionMapper2())
.deploy(testMicroservice).start();
secondMicroservicesRunner = new MicroservicesRunner(port + 1);
secondMicroservicesRunner.deploy(secondService).start();
>>>>>>>
microservicesRunner.addExceptionMapper(new TestExceptionMapper(), new TestExceptionMapper2())
.deploy(testMicroservice).start();
secondMicroservicesRunner = new MicroservicesRunner(port + 1);
secondMicroservicesRunner.deploy(secondService).start();
microservicesRunner.deploy(new TestMicroServiceWithDynamicPath(), "/DynamicPath"); |
<<<<<<<
@Override
public boolean isVisibleForModeratorAnd(User user) {
return !this.isVisible() && !user.isAuthorOf(this);
}
=======
@Override
public boolean hasPendingEdits() {
for (QuestionInformation information : history) {
if(information.isPending()) return true;
}
return false;
}
>>>>>>>
@Override
public boolean isVisibleForModeratorAnd(User user) {
return !this.isVisible() && !user.isAuthorOf(this);
}
@Override
public boolean hasPendingEdits() {
for (QuestionInformation information : history) {
if(information.isPending()) return true;
}
return false;
} |
<<<<<<<
public int getAnswersCount() {
return getAnswers().size();
}
=======
public boolean hasSolution() {
return solution != null;
}
>>>>>>>
public int getAnswersCount() {
return getAnswers().size();
}
public boolean hasSolution() {
return solution != null;
} |
<<<<<<<
public UpdateStatus updateWith(QuestionInformation information) {
UpdateStatus status = information.getAuthor().canUpdate(this);
if (status == UpdateStatus.REFUSED)
return status;
this.enqueueChange(information, status);
return status;
}
public void enqueueChange(QuestionInformation newInformation, UpdateStatus status) {
if(status.equals(UpdateStatus.NO_NEED_TO_APPROVE)) {
this.information = newInformation;
}
newInformation.setInitStatus(status);
this.history.add(newInformation);
this.touchedBy(newInformation.getAuthor());
}
=======
public List<QuestionInformation> getHistory() {
return history;
}
>>>>>>>
public UpdateStatus updateWith(QuestionInformation information) {
UpdateStatus status = information.getAuthor().canUpdate(this);
if (status == UpdateStatus.REFUSED)
return status;
this.enqueueChange(information, status);
return status;
}
public void enqueueChange(QuestionInformation newInformation, UpdateStatus status) {
if(status.equals(UpdateStatus.NO_NEED_TO_APPROVE)) {
this.information = newInformation;
}
newInformation.setInitStatus(status);
this.history.add(newInformation);
this.touchedBy(newInformation.getAuthor());
}
public List<QuestionInformation> getHistory() {
return history;
} |
<<<<<<<
public AnswerInformation(String description, LoggedUser currentUser) {
if (currentUser == null) {
=======
public AnswerInformation(String description, CurrentUser currentUser, String comment) {
if (currentUser == null) {
>>>>>>>
public AnswerInformation(String description, LoggedUser currentUser, String comment) {
if (currentUser == null) {
<<<<<<<
public AnswerInformation(String description, LoggedUser currentUser, Answer existentAnswer) {
this(description, currentUser);
=======
public AnswerInformation(String description, CurrentUser currentUser, Answer existentAnswer, String comment) {
this(description, currentUser, comment);
>>>>>>>
public AnswerInformation(String description, LoggedUser currentUser, Answer existentAnswer, String comment) {
this(description, currentUser, comment); |
<<<<<<<
import org.joda.time.LocalDate;
=======
>>>>>>>
import org.joda.time.LocalDate;
<<<<<<<
=======
import br.com.caelum.brutal.dao.QuestionDAO;
>>>>>>>
import br.com.caelum.brutal.dao.QuestionDAO;
<<<<<<<
private Validator validator;
=======
private final QuestionDAO questions;
>>>>>>>
private Validator validator;
private final QuestionDAO questions;
<<<<<<<
LoggedUser currentUser, Validator validator) {
=======
LoggedUser currentUser, QuestionDAO questions) {
>>>>>>>
LoggedUser currentUser, QuestionDAO questions, Validator validator) {
<<<<<<<
this.validator = validator;
=======
this.questions = questions;
>>>>>>>
this.validator = validator;
this.questions = questions; |
<<<<<<<
Information approved = new AnswerInformation("blablabalblab", new LoggedUser(editUser, null), answer);
=======
Information approved = new AnswerInformation("blablabalblab", new CurrentUser(editUser, null), answer, "");
>>>>>>>
Information approved = new AnswerInformation("blablabalblab", new LoggedUser(editUser, null), answer, "");
<<<<<<<
Information approved = new AnswerInformation("blablabalblab", new LoggedUser(editUser, null), answer);
=======
Information approved = new AnswerInformation("blablabalblab", new CurrentUser(editUser, null), answer, "");
>>>>>>>
Information approved = new AnswerInformation("blablabalblab", new LoggedUser(editUser, null), answer, ""); |
<<<<<<<
void setKarma(long karma) {
this.karma = karma;
}
=======
public String getEmail() {
return email;
}
>>>>>>>
void setKarma(long karma) {
this.karma = karma;
}
public String getEmail() {
return email;
}
<<<<<<<
public UpdateStatus canUpdate(Updatable updatable) {
User author = updatable.getAuthor();
if (author.getId().equals(id) || this.isModerator()) {
return UpdateStatus.NO_NEED_TO_APPROVE;
}
if (this.getKarma() >= MINIMUM_UPDATE_KARMA) {
return UpdateStatus.PENDING;
}
return UpdateStatus.REFUSED;
}
=======
public String touchForgotPasswordToken () {
this.forgotPasswordToken = Double.toString(Math.random());
return this.forgotPasswordToken;
}
public boolean isValidForgotPasswordToken(String token) {
return this.forgotPasswordToken.equals(token);
}
public boolean updateForgottenPassword(String password,
String password_confirmation) {
if(password.equals(password_confirmation)) {
this.password = br.com.caelum.brutal.infra.Digester.encrypt(password);
touchForgotPasswordToken();
return true;
}
return false;
}
>>>>>>>
public UpdateStatus canUpdate(Updatable updatable) {
User author = updatable.getAuthor();
if (author.getId().equals(id) || this.isModerator()) {
return UpdateStatus.NO_NEED_TO_APPROVE;
}
if (this.getKarma() >= MINIMUM_UPDATE_KARMA) {
return UpdateStatus.PENDING;
}
return UpdateStatus.REFUSED;
}
public String touchForgotPasswordToken () {
this.forgotPasswordToken = Double.toString(Math.random());
return this.forgotPasswordToken;
}
public boolean isValidForgotPasswordToken(String token) {
return this.forgotPasswordToken.equals(token);
}
public boolean updateForgottenPassword(String password,
String password_confirmation) {
if(password.equals(password_confirmation)) {
this.password = br.com.caelum.brutal.infra.Digester.encrypt(password);
touchForgotPasswordToken();
return true;
}
return false;
} |
<<<<<<<
import java.util.List;
=======
>>>>>>>
import java.util.List; |
<<<<<<<
import querqy.lucene.rewrite.*;
=======
import querqy.ComparableCharSequence;
import querqy.lucene.rewrite.*;
>>>>>>>
import querqy.ComparableCharSequence;
import querqy.lucene.rewrite.*;
<<<<<<<
public static final String QBOOST_METHOD = "qboost.method";
=======
public static final String QBOOST_METHOD = "qboost.method";
>>>>>>>
public static final String QBOOST_METHOD = "qboost.method";
<<<<<<<
/**
* Control how the score resulting from the {@link org.apache.lucene.search.similarities.Similarity}
* implementation is integrated into the score of a Querqy boost query
*/
public static final String QBOOST_SIMILARITY_SCORE = "qboost.similarityScore";
/**
* A possible value of QBOOST_SIMILARITY_SCORE: Do not calculate the similarity score for Querqy boost queries.
* As a result the boost queries are only scored by query boost and field boost but not by any function of DF or TF.
* Setting qboost.similarityScore=off yields a small performance gain as TF and DF need not be provided.
*/
public static final String QBOOST_SIMILARITY_SCORE_OFF = "off";
=======
/**
* Control how the score resulting from the {@link org.apache.lucene.search.similarities.Similarity}
* implementation is integrated into the score of a Querqy boost query
*/
public static final String QBOOST_SIMILARITY_SCORE = "qboost.similarityScore";
/**
* A possible value of QBOOST_SIMILARITY_SCORE: Do not calculate the similarity score for Querqy boost queries.
* As a result the boost queries are only scored by query boost and field boost but not by any function of DF or TF.
* Setting qboost.similarityScore=off yields a small performance gain as TF and DF need not be provided.
*/
public static final String QBOOST_SIMILARITY_SCORE_OFF = "off";
/**
* A possible value of QBOOST_SIMILARITY_SCORE: Just use the similarity as set in Solr when scoring Querqy boost queries.
*/
public static final String QBOOST_SIMILARITY_SCORE_ON = "on";
/**
* A possible value of QBOOST_SIMILARITY_SCORE: "document frequency correction" - use the similarity as set in Solr
* when scoring Querqy boost queries but fake the document frequency so that all term queries under a given
* {@link org.apache.lucene.search.DisjunctionMaxQuery} us the same document frequency. This avoids situations
* in which the rarer of two synonymous terms would get a higher score than the more common term. It also fixes
* the IDF problem for the same term value occurring in two or more different fields with different frequencies.
*
*/
public static final String QBOOST_SIMILARITY_SCORE_DFC = "dfc";
public static final String QBOOST_SIMILARITY_SCORE_DEFAULT = QBOOST_SIMILARITY_SCORE_DFC;
/**
* This parameter controls whether field boosting should be applied to Querqy boost queries.
*/
public static final String QBOOST_FIELD_BOOST = "qboost.fieldBoost";
/**
* A possible value of QBOOST_FIELD_BOOST: Do not apply any field boosting to Querqy boost queries.
*/
public static final String QBOOST_FIELD_BOOST_OFF = "off";
/**
* A possible value of QBOOST_FIELD_BOOST: Use the field boosting as set by parameter {@link #FBM} for Querqy boost
* queries.
*/
public static final String QBOOST_FIELD_BOOST_ON = "on";
public static final String QBOOST_FIELD_BOOST_DEFAULT = QBOOST_FIELD_BOOST_ON;
/**
* Tie parameter for combining pf, pf2 and pf3 phrase boostings into a dismax query. Defaults to the value
* of the {@link org.apache.solr.common.params.DisMaxParams.TIE} parameter
*/
public static final String QPF_TIE = "qpf.tie";
>>>>>>>
/**
* Control how the score resulting from the {@link org.apache.lucene.search.similarities.Similarity}
* implementation is integrated into the score of a Querqy boost query
*/
public static final String QBOOST_SIMILARITY_SCORE = "qboost.similarityScore";
/**
* A possible value of QBOOST_SIMILARITY_SCORE: Do not calculate the similarity score for Querqy boost queries.
* As a result the boost queries are only scored by query boost and field boost but not by any function of DF or TF.
* Setting qboost.similarityScore=off yields a small performance gain as TF and DF need not be provided.
*/
public static final String QBOOST_SIMILARITY_SCORE_OFF = "off";
/**
* Tie parameter for combining pf, pf2 and pf3 phrase boostings into a dismax query. Defaults to the value
* of the {@link org.apache.solr.common.params.DisMaxParams.TIE} parameter
*/
public static final String QPF_TIE = "qpf.tie";
<<<<<<<
final DocumentFrequencyAndTermContextProvider boostDftcp;
final SearchFieldsAndBoosting boostSearchFieldsAndBoostings;
=======
final DocumentFrequencyAndTermContextProvider boostDftcp;
final SearchFieldsAndBoosting boostSearchFieldsAndBoostings;
>>>>>>>
final DocumentFrequencyAndTermContextProvider boostDftcp;
final SearchFieldsAndBoosting boostSearchFieldsAndBoostings;
<<<<<<<
protected final TermQueryCache termQueryCache;
=======
protected final TermQueryCache termQueryCache;
protected final float qpfTie;
>>>>>>>
protected final TermQueryCache termQueryCache;
protected final float qpfTie;
<<<<<<<
this.termQueryCache = termQueryCache;
=======
this.termQueryCache = termQueryCache;
>>>>>>>
this.termQueryCache = termQueryCache;
<<<<<<<
final SearchFieldsAndBoosting searchFieldsAndBoosting =
=======
final SearchFieldsAndBoosting searchFieldsAndBoosting =
>>>>>>>
final SearchFieldsAndBoosting searchFieldsAndBoosting =
<<<<<<<
final String boostSimScore = solrParams.get(QBOOST_SIMILARITY_SCORE, QBOOST_SIMILARITY_SCORE_DEFAULT);
if (QBOOST_SIMILARITY_SCORE_DFC.equals(boostSimScore)) {
boostDftcp = dfc;
} else if (QBOOST_SIMILARITY_SCORE_ON.equals(boostSimScore)) {
boostDftcp = new StandardDocumentFrequencyAndTermContextProvider();
} else if (QBOOST_SIMILARITY_SCORE_OFF.equals(boostSimScore)) {
boostDftcp = null;
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown similarity score handling for Querqy boost queries: " + boostSimScore);
}
final String boostFieldBoost = solrParams.get(QBOOST_FIELD_BOOST, QBOOST_FIELD_BOOST_DEFAULT);
if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_ON)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting;
} else if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_OFF)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting.withFieldBoostModel(FieldBoostModel.NONE);
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown field boost model for Querqy boost queries: " + boostFieldBoost);
}
=======
final String boostSimScore = solrParams.get(QBOOST_SIMILARITY_SCORE, QBOOST_SIMILARITY_SCORE_DEFAULT);
if (QBOOST_SIMILARITY_SCORE_DFC.equals(boostSimScore)) {
boostDftcp = dfc;
} else if (QBOOST_SIMILARITY_SCORE_ON.equals(boostSimScore)) {
boostDftcp = new StandardDocumentFrequencyAndTermContextProvider();
} else if (QBOOST_SIMILARITY_SCORE_OFF.equals(boostSimScore)) {
boostDftcp = null;
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown similarity score handling for Querqy boost queries: " + boostSimScore);
}
final String boostFieldBoost = solrParams.get(QBOOST_FIELD_BOOST, QBOOST_FIELD_BOOST_DEFAULT);
if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_ON)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting;
} else if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_OFF)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting.withFieldBoostModel(FieldBoostModel.NONE);
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown field boost model for Querqy boost queries: " + boostFieldBoost);
}
qpfTie = solrParams.getFloat(QPF_TIE, config.getTieBreaker());
>>>>>>>
final String boostSimScore = solrParams.get(QBOOST_SIMILARITY_SCORE, QBOOST_SIMILARITY_SCORE_DEFAULT);
if (QBOOST_SIMILARITY_SCORE_DFC.equals(boostSimScore)) {
boostDftcp = dfc;
} else if (QBOOST_SIMILARITY_SCORE_ON.equals(boostSimScore)) {
boostDftcp = new StandardDocumentFrequencyAndTermContextProvider();
} else if (QBOOST_SIMILARITY_SCORE_OFF.equals(boostSimScore)) {
boostDftcp = null;
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown similarity score handling for Querqy boost queries: " + boostSimScore);
}
final String boostFieldBoost = solrParams.get(QBOOST_FIELD_BOOST, QBOOST_FIELD_BOOST_DEFAULT);
if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_ON)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting;
} else if (boostFieldBoost.equals(QBOOST_FIELD_BOOST_OFF)) {
boostSearchFieldsAndBoostings = searchFieldsAndBoosting.withFieldBoostModel(FieldBoostModel.NONE);
} else {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Unknown field boost model for Querqy boost queries: " + boostFieldBoost);
}
qpfTie = solrParams.getFloat(QPF_TIE, config.getTieBreaker());
<<<<<<<
LuceneQueryBuilder luceneQueryBuilder =
new LuceneQueryBuilder(boostDftcp, queryAnalyzer,
boostSearchFieldsAndBoostings,
config.getTieBreaker(), termQueryCache);
=======
LuceneQueryBuilder luceneQueryBuilder =
new LuceneQueryBuilder(boostDftcp, queryAnalyzer,
boostSearchFieldsAndBoostings,
config.getTieBreaker(), termQueryCache);
>>>>>>>
LuceneQueryBuilder luceneQueryBuilder =
new LuceneQueryBuilder(boostDftcp, queryAnalyzer,
boostSearchFieldsAndBoostings,
config.getTieBreaker(), termQueryCache);
<<<<<<<
luceneQuery = luceneQueryBuilder.createQuery((querqy.model.Query) boostQuery, factor < 0f);
=======
luceneQuery = luceneQueryBuilder.createQuery((querqy.model.Query) boostQuery, factor < 0f);
luceneQuery.setBoost(bq.getBoost() * factor);
>>>>>>>
luceneQuery = luceneQueryBuilder.createQuery((querqy.model.Query) boostQuery, factor < 0f);
<<<<<<<
final float boost = bq.getBoost() * factor;
if (boost != 1f) {
result.add(new org.apache.lucene.search.BoostQuery(luceneQuery, boost));
} else {
result.add(luceneQuery);
}
=======
result.add(luceneQuery);
>>>>>>>
final float boost = bq.getBoost() * factor;
if (boost != 1f) {
result.add(new org.apache.lucene.search.BoostQuery(luceneQuery, boost));
} else {
result.add(luceneQuery);
}
<<<<<<<
=======
>>>>>>> |
<<<<<<<
/*
* Copyright (C) 2012-2019 52°North Initiative for Geospatial Open Source
=======
/**
* Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source
>>>>>>>
/*
* Copyright (C) 2012-2020 52°North Initiative for Geospatial Open Source |
<<<<<<<
import org.apache.lucene.index.LeafReaderContext;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.IndexReaderContext;
=======
>>>>>>>
<<<<<<<
TermQuery makeTermQuery(int dfToSet) throws IOException {
IndexReaderContext context = indexSearcher.getTopReaderContext();
// This is copied/modified from
// org.apache.lucene.index.TermContext.build(IndexReaderContext, Term)
// Though TermQuery and TermState allow us to pass/set an arbitrary df
// value,
// org.apache.lucene.search.TermStatistics.TermStatistics(BytesRef, long,
// long) later asserts df <= total term frequency,
// which would cause an assertion error, if assertions are enabled. We
// create the TermContext ourselves as a workaround:
assert context != null && context.isTopLevel;
final String field = term.field();
final BytesRef bytes = term.bytes();
final TermContext perReaderTermState = new TermContext(context);
boolean updated = false;
for (final LeafReaderContext ctx : context.leaves()) {
// if (DEBUG) System.out.println(" r=" + leaves[i].reader);
final Fields fields = ctx.reader().fields();
if (fields != null) {
final Terms terms = fields.terms(field);
if (terms != null) {
final TermsEnum termsEnum = terms.iterator(null);
if (termsEnum.seekExact(bytes)) {
final TermState termState = termsEnum.termState();
// modified from TermContext.build():
perReaderTermState.register(termState, ctx.ord, termsEnum.docFreq(), -1);
updated = true;
}
}
}
}
if (updated) {
perReaderTermState.setDocFreq(dfToSet);
return new TermQuery(term, perReaderTermState);
} else {
// term does not exist
return new TermQuery(term);
}
}
@Override
public void collectMaxDocFreqInSubtree(DocumentFrequencyCorrection dfc) {
if (myDf == -1) {
myDf = dfc.collect(term);
}
}
=======
>>>>>>> |
<<<<<<<
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"a b\")^2.0')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"b c\")^2.0')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"c d\")^2.0')]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f40:\"a b\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f40:\"b c\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f40:\"c d\")^0.5'))]");
=======
"//str[@name='parsedquery_toString'][contains(.,'(f1:\"a b\" f1:\"b c\" f1:\"c d\")^2.0')]",
"//str[@name='parsedquery_toString'][not(contains(.,'(f40:\"a b\" f1:\"b c\" f1:\"c d\")^0.5'))]");
>>>>>>>
"//str[@name='parsedquery_toString'][contains(.,'(f1:\"a b\" f1:\"b c\" f1:\"c d\")^2.0')]",
"//str[@name='parsedquery_toString'][not(contains(.,'(f40:\"a b\" f1:\"b c\" f1:\"c d\")^0.5'))]");
<<<<<<<
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"a b\")^1.2')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"b c\")^1.2')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"c d\")^1.2')]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(str:\"a b\")^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(str:\"b c\")^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(str:\"c d\")^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tfp:\"a b\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tfp:\"b c\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tfp:\"c d\")^0.5'))]");
=======
"//str[@name='parsedquery'][contains(.,'f1:\"a b\"')]",
"//str[@name='parsedquery'][contains(.,'f1:\"b c\"')]",
"//str[@name='parsedquery'][contains(.,'f1:\"c d\"')]",
"//str[@name='parsedquery'][not(contains(.,'str:\"a b\"'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"b c\"'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"c d\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"a b\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"b c\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"c d\"'))]");
>>>>>>>
"//str[@name='parsedquery'][contains(.,'f1:\"a b\"')]",
"//str[@name='parsedquery'][contains(.,'f1:\"b c\"')]",
"//str[@name='parsedquery'][contains(.,'f1:\"c d\"')]",
"//str[@name='parsedquery'][not(contains(.,'str:\"a b\"'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"b c\"'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"c d\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"a b\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"b c\"'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"c d\"'))]");
<<<<<<<
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"a b c\")^1.2')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"b c d\")^1.2')]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(str:\"a b c\")^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(str:\"b c d\")^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tfp:\"a b c\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tfp:\"b c d\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tp:\"a b c\")^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'PhraseQuery(f_no_tp:\"b c d\")^0.5'))]");
=======
"//str[@name='parsedquery'][contains(.,'(f1:\"a b c\" f1:\"b c d\")^1.2')]",
"//str[@name='parsedquery'][not(contains(.,'str:\"a b c\"^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"b c d\"^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"a b c\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"b c d\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tp:\"a b c\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tp:\"b c d\"^0.5'))]");
>>>>>>>
"//str[@name='parsedquery'][contains(.,'(f1:\"a b c\" f1:\"b c d\")^1.2')]",
"//str[@name='parsedquery'][not(contains(.,'str:\"a b c\"^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'str:\"b c d\"^2.0'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"a b c\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tfp:\"b c d\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tp:\"a b c\"^0.5'))]",
"//str[@name='parsedquery'][not(contains(.,'f_no_tp:\"b c d\"^0.5'))]");
<<<<<<<
"(f2:\"a b c\")^2.5", "(f2:\"b c d\")^2.5",
"(f3:\"a b c\")^1.5", "(f3:\"b c d\")^1.5"
=======
"(f2:\"a b c\" f2:\"b c d\")^2.5",
"(f3:\"a b c\" f3:\"b c d\")^1.5"
>>>>>>>
"(f2:\"a b c\" f2:\"b c d\")^2.5",
"(f3:\"a b c\" f3:\"b c d\")^1.5"
<<<<<<<
"(f2:\"a b d e f\")^1.5", "(f3:\"a b d e f\")^1.5",
"(f1:\"a b\")^2.1", "(f1:\"b d\")^2.1", "(f1:\"d e\")^2.1", "(f1:\"e f\")^2.1",
"(f2:\"a b\")^2.1", "(f2:\"b d\")^2.1", "(f2:\"d e\")^2.1", "(f2:\"e f\")^2.1",
"(f3:\"a b d\")^3.9", "(f3:\"b d e\")^3.9", "(f3:\"d e f\")^3.9",
"(f1:\"a b d\")^3.9", "(f1:\"b d e\")^3.9", "(f1:\"d e f\")^3.9"
=======
"f2:\"a b d e f\"^1.5", "f3:\"a b d e f\"^1.5",
"(f1:\"a b\" f1:\"b d\" f1:\"d e\" f1:\"e f\")^2.1",
"(f2:\"a b\" f2:\"b d\" f2:\"d e\" f2:\"e f\")^2.1",
"(f3:\"a b d\" f3:\"b d e\" f3:\"d e f\")^3.9",
"(f1:\"a b d\" f1:\"b d e\" f1:\"d e f\")^3.9"
>>>>>>>
"(f2:\"a b d e f\")^1.5", "(f3:\"a b d e f\")^1.5",
"(f1:\"a b\" f1:\"b d\" f1:\"d e\" f1:\"e f\")^2.1",
"(f2:\"a b\" f2:\"b d\" f2:\"d e\" f2:\"e f\")^2.1",
"(f3:\"a b d\" f3:\"b d e\" f3:\"d e f\")^3.9",
"(f1:\"a b d\" f1:\"b d e\" f1:\"d e f\")^3.9"
<<<<<<<
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"a b\"~2)^2.1')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"b c\"~2)^2.1')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f1:\"c d\"~2)^2.1')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f2:\"a b c\"~3)^3.9')]",
"//str[@name='parsedquery'][contains(.,'PhraseQuery(f2:\"b c d\"~3)^3.9')]");
=======
"//str[@name='parsedquery'][contains(.,'(f1:\"a b\"~2 f1:\"b c\"~2 f1:\"c d\"~2)^2.1')]",
"//str[@name='parsedquery'][contains(.,'(f2:\"a b c\"~3 f2:\"b c d\"~3)^3.9')]");
>>>>>>>
"//str[@name='parsedquery'][contains(.,'(f1:\"a b\"~2 f1:\"b c\"~2 f1:\"c d\"~2)^2.1')]",
"//str[@name='parsedquery'][contains(.,'(f2:\"a b c\"~3 f2:\"b c d\"~3)^3.9')]"); |
<<<<<<<
mMainPresenter.loadWeather();
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
=======
mMainPresenter.loadWeather(location);
>>>>>>>
mMainPresenter.loadWeather(location);
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions); |
<<<<<<<
import com.itextpdf.licensekey.LicenseKey;
=======
import com.itextpdf.samples.GenericTest;
import com.itextpdf.test.annotations.type.SampleTest;
import org.junit.experimental.categories.Category;
>>>>>>>
<<<<<<<
=======
>>>>>>> |
<<<<<<<
private final BranchRepository branchRepository;
=======
private final CommitBaseDataMapper commitBaseDataMapper = new CommitBaseDataMapper();
private final FileBaseDataMapper fileBaseDataMapper = new FileBaseDataMapper();
>>>>>>>
private final BranchRepository branchRepository;
private final CommitBaseDataMapper commitBaseDataMapper = new CommitBaseDataMapper();
private final FileBaseDataMapper fileBaseDataMapper = new FileBaseDataMapper();
<<<<<<<
commitEntity = CommitBaseDataMapper.mapCommit(commit);
walkedCommits.put(commit, commitEntity);
result.add(commitEntity);
=======
commitEntity = commitBaseDataMapper.mapDomainObject(commit);
>>>>>>>
commitEntity = commitBaseDataMapper.mapDomainObject(commit);
walkedCommits.put(commit, commitEntity);
result.add(commitEntity); |
<<<<<<<
import com.itextpdf.kernel.colors.Color;
=======
import com.itextpdf.kernel.color.ColorConstants;
>>>>>>>
import com.itextpdf.kernel.colors.ColorConstants;
<<<<<<<
Table table = new Table(UnitValue.createPercentArray(5)).useAllAvailableWidth();
Cell sn = new Cell(2, 1).add(new Paragraph("S/N"));
sn.setBackgroundColor(Color.YELLOW);
=======
Table table = new Table(5);
Cell sn = new Cell(2, 1).add("S/N");
sn.setBackgroundColor(ColorConstants.YELLOW);
>>>>>>>
Table table = new Table(UnitValue.createPercentArray(5)).useAllAvailableWidth();
Cell sn = new Cell(2, 1).add(new Paragraph("S/N"));
sn.setBackgroundColor(ColorConstants.YELLOW);
<<<<<<<
Cell name = new Cell(1, 3).add(new Paragraph("Name"));
name.setBackgroundColor(Color.CYAN);
=======
Cell name = new Cell(1, 3).add("Name");
name.setBackgroundColor(ColorConstants.CYAN);
>>>>>>>
Cell name = new Cell(1, 3).add(new Paragraph("Name"));
name.setBackgroundColor(ColorConstants.CYAN);
<<<<<<<
Cell age = new Cell(2, 1).add(new Paragraph("Age"));
age.setBackgroundColor(Color.GRAY);
=======
Cell age = new Cell(2, 1).add("Age");
age.setBackgroundColor(ColorConstants.GRAY);
>>>>>>>
Cell age = new Cell(2, 1).add(new Paragraph("Age"));
age.setBackgroundColor(ColorConstants.GRAY);
<<<<<<<
Cell surname = new Cell().add(new Paragraph("SURNAME"));
surname.setBackgroundColor(Color.BLUE);
=======
Cell surname = new Cell().add("SURNAME");
surname.setBackgroundColor(ColorConstants.BLUE);
>>>>>>>
Cell surname = new Cell().add(new Paragraph("SURNAME"));
surname.setBackgroundColor(ColorConstants.BLUE);
<<<<<<<
Cell firstname = new Cell().add(new Paragraph("FIRST NAME"));
firstname.setBackgroundColor(Color.RED);
=======
Cell firstname = new Cell().add("FIRST NAME");
firstname.setBackgroundColor(ColorConstants.RED);
>>>>>>>
Cell firstname = new Cell().add(new Paragraph("FIRST NAME"));
firstname.setBackgroundColor(ColorConstants.RED);
<<<<<<<
Cell middlename = new Cell().add(new Paragraph("MIDDLE NAME"));
middlename.setBackgroundColor(Color.GREEN);
=======
Cell middlename = new Cell().add("MIDDLE NAME");
middlename.setBackgroundColor(ColorConstants.GREEN);
>>>>>>>
Cell middlename = new Cell().add(new Paragraph("MIDDLE NAME"));
middlename.setBackgroundColor(ColorConstants.GREEN);
<<<<<<<
Cell f1 = new Cell().add(new Paragraph("1"));
f1.setBackgroundColor(Color.PINK);
=======
Cell f1 = new Cell().add("1");
f1.setBackgroundColor(ColorConstants.PINK);
>>>>>>>
Cell f1 = new Cell().add(new Paragraph("1"));
f1.setBackgroundColor(ColorConstants.PINK);
<<<<<<<
Cell f2 = new Cell().add(new Paragraph("James"));
f2.setBackgroundColor(Color.MAGENTA);
=======
Cell f2 = new Cell().add("James");
f2.setBackgroundColor(ColorConstants.MAGENTA);
>>>>>>>
Cell f2 = new Cell().add(new Paragraph("James"));
f2.setBackgroundColor(ColorConstants.MAGENTA);
<<<<<<<
Cell f3 = new Cell().add(new Paragraph("Fish"));
f3.setBackgroundColor(Color.ORANGE);
=======
Cell f3 = new Cell().add("Fish");
f3.setBackgroundColor(ColorConstants.ORANGE);
>>>>>>>
Cell f3 = new Cell().add(new Paragraph("Fish"));
f3.setBackgroundColor(ColorConstants.ORANGE);
<<<<<<<
Cell f4 = new Cell().add(new Paragraph("Stone"));
f4.setBackgroundColor(Color.DARK_GRAY);
=======
Cell f4 = new Cell().add("Stone");
f4.setBackgroundColor(ColorConstants.DARK_GRAY);
>>>>>>>
Cell f4 = new Cell().add(new Paragraph("Stone"));
f4.setBackgroundColor(ColorConstants.DARK_GRAY);
<<<<<<<
Cell f5 = new Cell().add(new Paragraph("17"));
f5.setBackgroundColor(Color.LIGHT_GRAY);
=======
Cell f5 = new Cell().add("17");
f5.setBackgroundColor(ColorConstants.LIGHT_GRAY);
>>>>>>>
Cell f5 = new Cell().add(new Paragraph("17"));
f5.setBackgroundColor(ColorConstants.LIGHT_GRAY); |
<<<<<<<
import com.itextpdf.licensekey.LicenseKey;
=======
import com.itextpdf.samples.GenericTest;
import com.itextpdf.test.annotations.type.SampleTest;
import org.junit.experimental.categories.Category;
>>>>>>>
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import com.itextpdf.kernel.colors.Color;
=======
import com.itextpdf.kernel.color.ColorConstants;
>>>>>>>
import com.itextpdf.kernel.colors.ColorConstants;
<<<<<<<
table2.addCell(new Cell().setBorder(new SolidBorder(Color.RED, 1)).add(new Paragraph("Goodbye World")));
=======
table2.addCell(new Cell().setBorder(new SolidBorder(ColorConstants.RED, 1)).add("Goodbye World"));
>>>>>>>
table2.addCell(new Cell().setBorder(new SolidBorder(ColorConstants.RED, 1)).add(new Paragraph("Goodbye World")));
<<<<<<<
cell.setBorder(new SolidBorder(Color.BLACK, 1));
cell.add(new Paragraph("Hello World"));
=======
cell.setBorder(new SolidBorder(ColorConstants.BLACK, 1));
cell.add("Hello World");
>>>>>>>
cell.setBorder(new SolidBorder(ColorConstants.BLACK, 1));
cell.add(new Paragraph("Hello World")); |
<<<<<<<
IIngredientManager getIngredientManager();
=======
/**
* @since JEI 4.15.0
*/
IBookmarkOverlay getBookmarkOverlay();
/**
* @deprecated since JEI 4.5.0. Use {@link #getIngredientListOverlay()}
*/
@Deprecated
IItemListOverlay getItemListOverlay();
>>>>>>>
IBookmarkOverlay getBookmarkOverlay();
IIngredientManager getIngredientManager(); |
<<<<<<<
public void drawOnForeground(ContainerScreen gui, int mouseX, int mouseY) {
=======
public void drawOnForeground(Minecraft minecraft, GuiContainer gui, int mouseX, int mouseY) {
>>>>>>>
public void drawOnForeground(Minecraft minecraft, ContainerScreen gui, int mouseX, int mouseY) {
<<<<<<<
GlStateManager.translatef(-gui.getGuiLeft(), -gui.getGuiTop(), 0);
this.ghostIngredientDragManager.drawOnForeground(gui.getMinecraft(), mouseX, mouseY);
=======
GlStateManager.translate(-gui.getGuiLeft(), -gui.getGuiTop(), 0);
this.ghostIngredientDragManager.drawOnForeground(minecraft, mouseX, mouseY);
>>>>>>>
GlStateManager.translatef(-gui.getGuiLeft(), -gui.getGuiTop(), 0);
this.ghostIngredientDragManager.drawOnForeground(minecraft, mouseX, mouseY); |
<<<<<<<
import mezz.jei.api.IIngredientFilter;
=======
import mezz.jei.api.IBookmarkOverlay;
>>>>>>>
import mezz.jei.api.IIngredientFilter;
import mezz.jei.api.IBookmarkOverlay;
<<<<<<<
=======
private final IBookmarkOverlay bookmarkOverlay;
private final ItemListOverlay itemListOverlay;
>>>>>>>
private final IBookmarkOverlay bookmarkOverlay;
<<<<<<<
public JeiRuntime(RecipeManager recipeManager, IngredientListOverlay ingredientListOverlay, RecipesGui recipesGui, IIngredientFilter ingredientFilter, IIngredientManager ingredientManager) {
this.recipeManager = recipeManager;
=======
public JeiRuntime(RecipeRegistry recipeRegistry, IngredientListOverlay ingredientListOverlay, IBookmarkOverlay bookmarkOverlay, RecipesGui recipesGui, IngredientFilter ingredientFilter) {
this.recipeRegistry = recipeRegistry;
>>>>>>>
public JeiRuntime(RecipeManager recipeManager, IngredientListOverlay ingredientListOverlay, IBookmarkOverlay bookmarkOverlay, RecipesGui recipesGui, IIngredientFilter ingredientFilter, IIngredientManager ingredientManager) {
this.recipeManager = recipeManager;
<<<<<<<
public IIngredientManager getIngredientManager() {
return ingredientManager;
}
@Override
=======
public IBookmarkOverlay getBookmarkOverlay() {
return bookmarkOverlay;
}
@Override
>>>>>>>
public IIngredientManager getIngredientManager() {
return ingredientManager;
}
@Override
public IBookmarkOverlay getBookmarkOverlay() {
return bookmarkOverlay;
}
@Override |
<<<<<<<
import java.util.Collections;
import java.util.List;
=======
import mezz.jei.util.LimitedLogger;
import mezz.jei.util.Log;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
>>>>>>>
import java.time.Duration;
import java.util.Collections;
import java.util.List;
<<<<<<<
=======
private final RecipeRegistry recipeRegistry;
private final LimitedLogger missingBackgroundLogger = new LimitedLogger(Log.get(), Duration.ofHours(1));
>>>>>>> |
<<<<<<<
import io.reflectoring.coderadar.projectadministration.service.filepattern.FilePatternMatcher;
=======
>>>>>>>
import io.reflectoring.coderadar.projectadministration.service.filepattern.FilePatternMatcher;
<<<<<<<
List<MetricValue> analyzeCommit(Commit commit, Project project, List<SourceCodeFileAnalyzerPlugin> analyzers, FilePatternMatcher filePatterns);
=======
List<MetricValue> analyzeCommit(
Commit commit, Project project, List<SourceCodeFileAnalyzerPlugin> analyzers);
>>>>>>>
List<MetricValue> analyzeCommit(Commit commit, Project project, List<SourceCodeFileAnalyzerPlugin> analyzers, FilePatternMatcher filePatterns); |
<<<<<<<
=======
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.hateoas.ResourceSupport;
>>>>>>>
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
<<<<<<<
public class CommitProfileRatingsOutputResource {
=======
@NoArgsConstructor
@Data
@EqualsAndHashCode(callSuper = true)
public class CommitProfileRatingsOutputResource extends ResourceSupport {
>>>>>>>
@NoArgsConstructor
@Data
@EqualsAndHashCode
public class CommitProfileRatingsOutputResource { |
<<<<<<<
import java.util.stream.Collector;
=======
import java.util.stream.Stream;
>>>>>>>
import java.util.stream.Collector;
import java.util.stream.Stream; |
<<<<<<<
public Object invoke(HandleDing h, final Object target, Object[] args, MethodProxy mp) throws Exception
=======
public Object invoke(Supplier<Handle> handle, final Object target, Object[] args, MethodProxy mp)
>>>>>>>
public Object invoke(Supplier<Handle> handle, final Object target, Object[] args, MethodProxy mp) throws Exception
<<<<<<<
h.retain("transaction#implicit");
try {
@SuppressWarnings("unchecked")
final Transaction<Object, Object, Exception> t = (Transaction) args[0];
return h.getHandle().inTransaction((conn, status) -> t.inTransaction(target, status));
}
finally {
h.release("transaction#implicit");
}
=======
@SuppressWarnings("unchecked")
final Transaction<Object, Object> t = (Transaction<Object, Object>) args[0];
return handle.get().inTransaction((conn, status) -> t.inTransaction(target, status));
>>>>>>>
@SuppressWarnings("unchecked")
final Transaction<Object, Object, Exception> t = (Transaction) args[0];
return handle.get().inTransaction((conn, status) -> t.inTransaction(target, status)); |
<<<<<<<
public static class FooProperty {
private final Object foo;
FooProperty(Object foo) {
this.foo = foo;
}
@SuppressWarnings("unused")
public Object getFoo() {
return foo;
}
}
public static class IdProperty {
private final long id;
IdProperty(long id) {
this.id = id;
}
public long getId() {
return id;
}
}
=======
@Test
public void testPrivateClass() throws Exception {
new ObjectMethodArguments(null, Person.create("hello")).find("name", ctx).get().apply(4, stmt, null);
verify(stmt).setString(4, "hello");
}
@Test
public void testPrivateInterfaceClass() throws Exception {
new ObjectMethodArguments(null, Car.create("hello")).find("name", ctx).get().apply(4, stmt, null);
verify(stmt).setString(4, "hello");
}
public abstract static class Person {
public static Person create(String name) {
return new PersonImpl(name);
}
public abstract String name();
private static class PersonImpl extends Person {
private String name;
PersonImpl(String name) {
this.name = name;
}
@Override
public String name() {
return name;
}
}
}
public interface Car {
static Car create(String name) {
return new CarImpl(name);
}
String name();
}
private static class CarImpl implements Car {
private String name;
CarImpl(String name) {
this.name = name;
}
@Override
public String name() {
return name;
}
}
>>>>>>>
public static class FooProperty {
private final Object foo;
FooProperty(Object foo) {
this.foo = foo;
}
@SuppressWarnings("unused")
public Object getFoo() {
return foo;
}
}
public static class IdProperty {
private final long id;
IdProperty(long id) {
this.id = id;
}
public long getId() {
return id;
}
}
@Test
public void testPrivateClass() throws Exception {
new ObjectMethodArguments(null, Person.create("hello")).find("name", ctx).get().apply(4, stmt, null);
verify(stmt).setString(4, "hello");
}
@Test
public void testPrivateInterfaceClass() throws Exception {
new ObjectMethodArguments(null, Car.create("hello")).find("name", ctx).get().apply(4, stmt, null);
verify(stmt).setString(4, "hello");
}
public abstract static class Person {
public static Person create(String name) {
return new PersonImpl(name);
}
public abstract String name();
private static class PersonImpl extends Person {
private String name;
PersonImpl(String name) {
this.name = name;
}
@Override
public String name() {
return name;
}
}
}
public interface Car {
static Car create(String name) {
return new CarImpl(name);
}
String name();
}
private static class CarImpl implements Car {
private String name;
CarImpl(String name) {
this.name = name;
}
@Override
public String name() {
return name;
}
} |
<<<<<<<
final int columnIndex = findColumnIndex(paramName, columnNames, columnNameMatchers,
() -> debugName(parameter))
.orElseThrow(() -> new IllegalArgumentException(String.format(
"Constructor '%s' parameter '%s' has no column in the result set. "
+ "Verify that the Java compiler is configured to emit parameter names, "
+ "that your result set has the columns expected, or annotate the "
+ "parameter names explicitly with @ColumnName",
constructor,
paramName
)));
final QualifiedType type = QualifiedType.of(
parameter.getParameterizedType(),
getQualifyingAnnotations(parameter));
mappers[i] = ctx.findColumnMapperFor(type)
.map(mapper -> new SingleColumnMapper<>(mapper, columnIndex + 1))
.orElseThrow(() -> new IllegalArgumentException(String.format(
"Could not find column mapper for type '%s' of parameter '%s' for constructor '%s'",
type, paramName, constructor)));
unmatchedColumns.remove(columnNames.get(columnIndex));
=======
final OptionalInt columnIndex = findColumnIndex(paramName, columnNames, columnNameMatchers,
() -> debugName(parameter));
if (columnIndex.isPresent()) {
int colIndex = columnIndex.getAsInt();
final Type type = parameter.getParameterizedType();
mappers[i] = ctx.findColumnMapperFor(type)
.map(mapper -> new SingleColumnMapper<>(mapper, colIndex + 1))
.orElseThrow(() -> new IllegalArgumentException(
String.format(MISSING_COLUMN_MAPPER, type, paramName, constructor)));
matchedColumns = true;
unmatchedColumns.remove(columnNames.get(colIndex));
} else if (nullable) {
mappers[i] = (r, c) -> null;
} else {
unmatchedParameters.add(paramName);
}
>>>>>>>
final OptionalInt columnIndex = findColumnIndex(paramName, columnNames, columnNameMatchers,
() -> debugName(parameter));
if (columnIndex.isPresent()) {
int colIndex = columnIndex.getAsInt();
final QualifiedType type = QualifiedType.of(
parameter.getParameterizedType(),
getQualifyingAnnotations(parameter));
mappers[i] = ctx.findColumnMapperFor(type)
.map(mapper -> new SingleColumnMapper<>(mapper, colIndex + 1))
.orElseThrow(() -> new IllegalArgumentException(
String.format(MISSING_COLUMN_MAPPER, type, paramName, constructor)));
matchedColumns = true;
unmatchedColumns.remove(columnNames.get(colIndex));
} else if (nullable) {
mappers[i] = (r, c) -> null;
} else {
unmatchedParameters.add(paramName);
} |
<<<<<<<
=======
import io.reflectoring.coderadar.core.vcs.port.driver.CloneRepositoryUseCase;
>>>>>>>
import io.reflectoring.coderadar.core.vcs.port.driver.CloneRepositoryUseCase;
<<<<<<<
import java.util.Optional;
=======
>>>>>>>
import java.util.Optional;
<<<<<<<
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.springframework.test.context.junit.jupiter.SpringExtension;
=======
>>>>>>>
<<<<<<<
@Mock private CreateProjectPort createProjectPort;
@Mock private GetProjectPort getProjectPort;
@Mock private CoderadarConfigurationProperties coderadarConfigurationProperties;
@InjectMocks private CreateProjectService testSubject;
=======
private CreateProjectPort createProjectPort = mock(CreateProjectPort.class);
private CloneRepositoryUseCase cloneRepositoryUseCase = mock(CloneRepositoryUseCase.class);
private CoderadarConfigurationProperties coderadarConfigurationProperties =
mock(CoderadarConfigurationProperties.class);
>>>>>>>
private CreateProjectPort createProjectPort = mock(CreateProjectPort.class);
private GetProjectPort getProjectPort = mock(GetProjectPort.class);
private CloneRepositoryUseCase cloneRepositoryUseCase = mock(CloneRepositoryUseCase.class);
private CoderadarConfigurationProperties coderadarConfigurationProperties =
mock(CoderadarConfigurationProperties.class);
<<<<<<<
when(coderadarConfigurationProperties.getWorkdir())
.thenReturn(new File("coderadar-workdir").toPath());
=======
CreateProjectService testSubject =
new CreateProjectService(
createProjectPort, cloneRepositoryUseCase, coderadarConfigurationProperties);
when(coderadarConfigurationProperties.getWorkdir())
.thenReturn(new File("coderadar-workdir").toPath());
>>>>>>>
CreateProjectService testSubject =
new CreateProjectService(
createProjectPort,
getProjectPort,
cloneRepositoryUseCase,
coderadarConfigurationProperties);
when(coderadarConfigurationProperties.getWorkdir())
.thenReturn(new File("coderadar-workdir").toPath()); |
<<<<<<<
private final List<JdbiPlugin> plugins = new ArrayList<>();
=======
private String[] migrationScriptPaths;
private List<JdbiPlugin> plugins = new ArrayList<>();
>>>>>>>
private String[] migrationScriptPaths;
private final List<JdbiPlugin> plugins = new ArrayList<>(); |
<<<<<<<
import static org.jdbi.v3.Types.findGenericParameter;
import static org.jdbi.v3.Types.getErasedType;
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
=======
>>>>>>>
import static org.jdbi.v3.Types.findGenericParameter;
import static org.jdbi.v3.Types.getErasedType;
import java.lang.reflect.Type;
<<<<<<<
public class BuiltInArgumentFactory implements ArgumentFactory<Object> {
=======
/**
* The BuiltInArgumentFactory provides instances of {@link Argument} for
* many core Java types. Generally you should not need to use this
* class directly, but instead should bind your object with the
* {@link SQLStatement} convenience methods.
*/
public class BuiltInArgumentFactory<T> implements ArgumentFactory<T> {
// Care for the initialization order here, there's a fair number of statics. Create the builders before the factory instance.
private static final ArgBuilder<String> STR_BUILDER = v -> new BuiltInArgument<>(String.class, Types.VARCHAR, PreparedStatement::setString, v);
private static final ArgBuilder<Object> OBJ_BUILDER = v -> new BuiltInArgument<>(Object.class, Types.NULL, PreparedStatement::setObject, v);
private static final Map<Class<?>, ArgBuilder<?>> BUILDERS = createInternalBuilders();
>>>>>>>
/**
* The BuiltInArgumentFactory provides instances of {@link Argument} for
* many core Java types. Generally you should not need to use this
* class directly, but instead should bind your object with the
* {@link SQLStatement} convenience methods.
*/
public class BuiltInArgumentFactory implements ArgumentFactory<Object> {
// Care for the initialization order here, there's a fair number of statics. Create the builders before the factory instance.
private static final ArgBuilder<String> STR_BUILDER = v -> new BuiltInArgument<>(String.class, Types.VARCHAR, PreparedStatement::setString, v);
private static final ArgBuilder<Object> OBJ_BUILDER = v -> new BuiltInArgument<>(Object.class, Types.NULL, PreparedStatement::setObject, v);
private static final Map<Class<?>, ArgBuilder<?>> BUILDERS = createInternalBuilders();
<<<<<<<
if (value instanceof Enum) {
return new StringArgument(((Enum<?>)value).name());
}
if (value instanceof Optional) {
Object nestedValue = ((Optional<?>)value).orElse(null);
Type nestedType = findOptionalType(expectedType, nestedValue);
return ctx.argumentFor(nestedType, nestedValue);
=======
if (value != null && value.getClass().isEnum()) {
return STR_BUILDER.build((((Enum<?>)value).name()));
>>>>>>>
if (value instanceof Enum) {
return STR_BUILDER.build((((Enum<?>)value).name()));
}
if (value instanceof Optional) {
Object nestedValue = ((Optional<?>)value).orElse(null);
Type nestedType = findOptionalType(expectedType, nestedValue);
return ctx.argumentFor(nestedType, nestedValue);
<<<<<<<
private Type findOptionalType(Type wrapperType, Object nestedValue) {
if (getErasedType(wrapperType).equals(Optional.class)) {
Optional<Type> nestedType = findGenericParameter(wrapperType, Optional.class);
if (nestedType.isPresent()) {
return nestedType.get();
}
}
return nestedValue == null ? Object.class : nestedValue.getClass();
}
private static class P
{
private final Constructor<?> ctor;
=======
@FunctionalInterface
interface StatementBinder<T> {
void bind(PreparedStatement p, int index, T value) throws SQLException;
}
>>>>>>>
private Type findOptionalType(Type wrapperType, Object nestedValue) {
if (getErasedType(wrapperType).equals(Optional.class)) {
Optional<Type> nestedType = findGenericParameter(wrapperType, Optional.class);
if (nestedType.isPresent()) {
return nestedType.get();
}
}
return nestedValue == null ? Object.class : nestedValue.getClass();
}
@FunctionalInterface
interface StatementBinder<T> {
void bind(PreparedStatement p, int index, T value) throws SQLException;
} |
<<<<<<<
Object invoke(HandleDing h, Object target, Object[] args, MethodProxy mp) throws Exception;
=======
Object invoke(Supplier<Handle> handle, Object target, Object[] args, MethodProxy mp);
>>>>>>>
Object invoke(Supplier<Handle> handle, Object target, Object[] args, MethodProxy mp) throws Exception; |
<<<<<<<
LazyHandle(DBI dbi) {
=======
public LazyHandle(Jdbi dbi) {
>>>>>>>
LazyHandle(Jdbi dbi) { |
<<<<<<<
import static java.util.Collections.synchronizedMap;
=======
import org.jdbi.v3.core.config.ConfigRegistry;
import org.jdbi.v3.core.extension.ExtensionFactory;
import org.jdbi.v3.core.extension.ExtensionMethod;
import org.jdbi.v3.core.extension.HandleSupplier;
import org.jdbi.v3.sqlobject.config.Configurer;
import org.jdbi.v3.sqlobject.config.ConfiguringAnnotation;
>>>>>>>
import static java.util.Collections.synchronizedMap;
import org.jdbi.v3.core.config.ConfigRegistry;
import org.jdbi.v3.core.extension.ExtensionFactory;
import org.jdbi.v3.core.extension.ExtensionMethod;
import org.jdbi.v3.core.extension.HandleSupplier;
import org.jdbi.v3.sqlobject.config.Configurer;
import org.jdbi.v3.sqlobject.config.ConfiguringAnnotation; |
<<<<<<<
* @return an {@link NVarchar} qualifying annotation instance.
*/
public static NVarchar nVarchar() {
return AnnotationFactory.create(NVarchar.class);
}
/**
=======
>>>>>>> |
<<<<<<<
import org.skife.jdbi.v2.Query;
import org.skife.jdbi.v2.ResultIterator;
=======
import org.skife.jdbi.v2.StatementContext;
>>>>>>>
import org.skife.jdbi.v2.StatementContext;
<<<<<<<
=======
import org.skife.jdbi.v2.sqlobject.mixins.CloseMe;
import org.skife.jdbi.v2.tweak.HandleCallback;
>>>>>>>
import org.skife.jdbi.v2.sqlobject.mixins.CloseMe;
import org.skife.jdbi.v2.tweak.HandleCallback;
<<<<<<<
import static java.util.Arrays.asList;
=======
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
>>>>>>>
<<<<<<<
@Test
public void testMappingExample() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
Query<Map<String, Object>> q =
h.createQuery("select name from something order by id");
Query<String> q2 = q.map(StringMapper.FIRST);
List<String> rs = q2.list();
assertThat(rs, equalTo(asList("Brian", "Keith")));
h.close();
}
@Test
public void testMappingExampleChained() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
List<String> rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.list();
assertThat(rs, equalTo(asList("Brian", "Keith")));
h.close();
}
@Test
public void testMappingExampleChainedFirst() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
String rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.first();
assertThat(rs, equalTo("Brian"));
h.close();
}
@Test
public void testMappingExampleChainedIterator() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
ResultIterator<String> rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.iterator();
assertThat(rs.next(), equalTo("Brian"));
assertThat(rs.next(), equalTo("Keith"));
assertThat(rs.hasNext(), equalTo(false));
rs.close();
h.close();
}
@Test
public void testMappingExampleChainedIterator2() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
Iterator<String> rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.iterator();
assertThat(rs.next(), equalTo("Brian"));
assertThat(rs.next(), equalTo("Keith"));
assertThat(rs.hasNext(), equalTo(false));
h.close();
}
@Test
public void testMappingExampleChainedIterator3() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
for (String name : h.createQuery("select name from something order by id").map(StringMapper.FIRST))
{
assertThat(name, equalsOneOf("Brian", "Keith"));
}
h.close();
}
=======
@Test
public void testObtainHandleViaOpen() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle handle = dbi.open();
// make sure to close it!
handle.close();
}
@Test
public void testObtainHandleInCallback() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
dbi.withHandle(new HandleCallback<Void>()
{
public Void withHandle(Handle handle) throws Exception
{
handle.execute("create table silly (id int)");
return null;
}
});
}
@Test
public void testExecuteSomeStatements() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (?, ?)", 3, "Patrick");
List<Map<String, Object>> rs = h.select("select id, name from something");
assertThat(rs.size(), equalTo(1));
Map<String, Object> row = rs.get(0);
assertThat((Integer) row.get("id"), equalTo(3));
assertThat((String) row.get("name"), equalTo("Patrick"));
h.close();
}
@Test
public void testFluentUpdate() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.createStatement("insert into something(id, name) values (:id, :name)")
.bind("id", 4)
.bind("name", "Martin")
.execute();
h.close();
}
@Test
public void testFold() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (7, 'Mark')");
h.execute("insert into something (id, name) values (8, 'Tatu')");
StringBuilder rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.fold(new StringBuilder(), new Folder2<StringBuilder>()
{
public StringBuilder fold(StringBuilder acc, ResultSet rs, StatementContext ctx) throws SQLException
{
acc.append(rs.getString(1)).append(", ");
return acc;
}
});
rs.delete(rs.length() - 2, rs.length()); // trim the extra ", "
assertThat(rs.toString(), equalTo("Mark, Tatu"));
h.close();
}
>>>>>>>
@Test
public void testObtainHandleViaOpen() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle handle = dbi.open();
// make sure to close it!
handle.close();
}
@Test
public void testObtainHandleInCallback() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
dbi.withHandle(new HandleCallback<Void>()
{
public Void withHandle(Handle handle) throws Exception
{
handle.execute("create table silly (id int)");
return null;
}
});
}
@Test
public void testExecuteSomeStatements() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (?, ?)", 3, "Patrick");
List<Map<String, Object>> rs = h.select("select id, name from something");
assertThat(rs.size(), equalTo(1));
Map<String, Object> row = rs.get(0);
assertThat((Integer) row.get("id"), equalTo(3));
assertThat((String) row.get("name"), equalTo("Patrick"));
h.close();
}
@Test
public void testFluentUpdate() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.createStatement("insert into something(id, name) values (:id, :name)")
.bind("id", 4)
.bind("name", "Martin")
.execute();
h.close();
}
@Test
public void testFold() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (7, 'Mark')");
h.execute("insert into something (id, name) values (8, 'Tatu')");
StringBuilder rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.fold(new StringBuilder(), new Folder2<StringBuilder>()
{
public StringBuilder fold(StringBuilder acc, ResultSet rs, StatementContext ctx) throws SQLException
{
acc.append(rs.getString(1)).append(", ");
return acc;
}
});
rs.delete(rs.length() - 2, rs.length()); // trim the extra ", "
assertThat(rs.toString(), equalTo("Mark, Tatu"));
h.close();
}
@Test
public void testMappingExampleChainedIterator2() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
Iterator<String> rs = h.createQuery("select name from something order by id")
.map(StringMapper.FIRST)
.iterator();
assertThat(rs.next(), equalTo("Brian"));
assertThat(rs.next(), equalTo("Keith"));
assertThat(rs.hasNext(), equalTo(false));
h.close();
}
@Test
public void testMappingExampleChainedIterator3() throws Exception
{
DBI dbi = new DBI("jdbc:h2:mem:test");
Handle h = dbi.open();
h.execute("create table something (id int primary key, name varchar(100))");
h.execute("insert into something (id, name) values (1, 'Brian')");
h.execute("insert into something (id, name) values (2, 'Keith')");
for (String name : h.createQuery("select name from something order by id").map(StringMapper.FIRST))
{
assertThat(name, equalsOneOf("Brian", "Keith"));
}
h.close();
} |
<<<<<<<
final TransactionIsolationLevel initial = getTransactionIsolationLevel();
boolean failed = true;
try {
setTransactionIsolation(level);
ReturnType result = inTransaction(callback);
failed = false;
return result;
}
finally {
try {
setTransactionIsolation(initial);
}
catch (RuntimeException e) {
if (! failed) {
throw e;
}
// Ignore, there was already an exceptional condition and we don't want to clobber it.
}
}
=======
return transactions.inTransaction(this, level, callback);
>>>>>>>
final TransactionIsolationLevel initial = getTransactionIsolationLevel();
boolean failed = true;
try {
setTransactionIsolation(level);
ReturnType result = transactions.inTransaction(this, level, callback);
failed = false;
return result;
}
finally {
try {
setTransactionIsolation(initial);
}
catch (RuntimeException e) {
if (! failed) {
throw e;
}
// Ignore, there was already an exceptional condition and we don't want to clobber it.
}
} |
<<<<<<<
private static final String BASE_VOCAB_NS = "neo4j://com.neo4j/voc#";
private static final String BASE_INDIV_NS = "neo4j://com.neo4j/indiv#";
=======
public static final String BASE_VOCAB_NS = "neo4j://vocabulary#";
public static final String BASE_INDIV_NS = "neo4j://individuals#";
>>>>>>>
private static final String BASE_VOCAB_NS = "neo4j://vocabulary#";
private static final String BASE_INDIV_NS = "neo4j://individuals#";
<<<<<<<
try (Transaction tx = gds.beginTx(); Result result = gds.execute(jsonMap.get("cypher"))) {
final boolean onlyMapped = jsonMap.containsKey("showOnlyMapped");
Set<ContextResource> serializedNodes = new HashSet<ContextResource>();
=======
try (Transaction tx = gds.beginTx()) {
final boolean onlyMapped = jsonMap.containsKey("mappedElemsOnly");
final Map<String, Object> queryParams = (Map<String, Object>) jsonMap
.getOrDefault("cypherParams", new HashMap<String, Object>());
Result result = gds.execute((String) jsonMap.get("cypher"), queryParams);
Set<String> serializedNodes = new HashSet<String>();
>>>>>>>
try (Transaction tx = gds.beginTx(); Result result = gds.execute((String) jsonMap.get("cypher"), (Map<String, Object>) jsonMap.getOrDefault("cypherParams", new HashMap<String, Object>()))) {
final boolean onlyMapped = jsonMap.containsKey("mappedElemsOnly");
Set<ContextResource> serializedNodes = new HashSet<ContextResource>();
<<<<<<<
ContextResource currentContextResource = new ContextResource(
n.hasProperty("uri") ?
n.getProperty("uri").toString() : null,
n.hasProperty("graphUri") ?
n.getProperty("graphUri").toString() : null);
if (!serializedNodes.contains(currentContextResource)) {
processNode(namespaces, writer, valueFactory, baseVocabNS, n);
serializedNodes.add(currentContextResource);
=======
if (!serializedNodes.contains(n.getProperty("uri").toString())) {
processNode(namespaces, writer, valueFactory, BASE_VOCAB_NS, n);
serializedNodes.add(n.getProperty("uri").toString());
>>>>>>>
ContextResource currentContextResource = new ContextResource(
n.hasProperty("uri") ?
n.getProperty("uri").toString() : null,
n.hasProperty("graphUri") ?
n.getProperty("graphUri").toString() : null);
if (!serializedNodes.contains(currentContextResource)) {
processNode(namespaces, writer, valueFactory, BASE_VOCAB_NS, n);
serializedNodes.add(currentContextResource);
<<<<<<<
.anyMatch(name -> Label.label("Resource").equals(name)) &&
!serializedNodes.contains(currentContextResource)) {
processNode(namespaces, writer, valueFactory, baseVocabNS, node);
serializedNodes.add(currentContextResource);
=======
.anyMatch(name -> Label.label("Resource").equals(name)) && !serializedNodes
.contains(node.getProperty("uri").toString())) {
processNode(namespaces, writer, valueFactory, BASE_VOCAB_NS, node);
serializedNodes.add(node.getProperty("uri").toString());
>>>>>>>
.anyMatch(name -> Label.label("Resource").equals(name)) &&
!serializedNodes.contains(currentContextResource)) {
processNode(namespaces, writer, valueFactory, BASE_VOCAB_NS, node);
serializedNodes.add(currentContextResource);
<<<<<<<
processNode(namespaces, writer, valueFactory, baseVocabNS, node);
=======
Node node = (Node) row.get("x");
Iterable<Label> nodeLabels = node.getLabels();
for (Label label : nodeLabels) {
//Exclude the Resource category created by the importer to emulate RDF
if (!label.name().equals("Resource")) {
writer.handleStatement(
valueFactory.createStatement(getResource(idParam.toString(), valueFactory),
RDF.TYPE,
valueFactory.createIRI(
buildURI(BASE_VOCAB_NS, label.name(), namespaces))));
}
}
Map<String, Object> allProperties = node.getAllProperties();
for (String key : allProperties.keySet()) {
if (!key.equals("uri")) {
Resource subject = getResource(idParam.toString(), valueFactory);
IRI predicate = valueFactory.createIRI(buildURI(BASE_VOCAB_NS, key, namespaces));
Object propertyValueObject = allProperties.get(key);
if (propertyValueObject instanceof Object[]) {
for (int i = 0; i < ((Object[]) propertyValueObject).length; i++) {
Literal object = createTypedLiteral(valueFactory,
(buildCustomDTFromShortURI((String) ((Object[]) propertyValueObject)[i],
namespaces)));
writer.handleStatement(
valueFactory.createStatement(subject, predicate, object));
}
} else if (propertyValueObject instanceof long[]) {
for (int i = 0; i < ((long[]) propertyValueObject).length; i++) {
Literal object = createTypedLiteral(valueFactory,
((long[]) propertyValueObject)[i]);
writer.handleStatement(
valueFactory.createStatement(subject, predicate, object));
}
} else if (propertyValueObject instanceof double[]) {
for (int i = 0; i < ((double[]) propertyValueObject).length; i++) {
Literal object = createTypedLiteral(valueFactory,
((double[]) propertyValueObject)[i]);
writer.handleStatement(
valueFactory.createStatement(subject, predicate, object));
}
} else if (propertyValueObject instanceof boolean[]) {
for (int i = 0; i < ((boolean[]) propertyValueObject).length; i++) {
Literal object = createTypedLiteral(valueFactory,
((boolean[]) propertyValueObject)[i]);
writer.handleStatement(
valueFactory.createStatement(subject, predicate, object));
}
} else {
Literal object;
if (propertyValueObject instanceof String) {
object = createTypedLiteral(valueFactory,
(buildCustomDTFromShortURI((String) propertyValueObject, namespaces)));
} else {
object = createTypedLiteral(valueFactory, propertyValueObject);
}
writer.handleStatement(
valueFactory.createStatement(subject, predicate, object));
}
}
}
>>>>>>>
processNode(namespaces, writer, valueFactory, BASE_VOCAB_NS, node);
<<<<<<<
processRelationship(namespaces, writer, valueFactory, baseVocabNS, rel);
=======
Resource subject = getResource(rel.getStartNode().getProperty("uri").toString(),
valueFactory);
IRI predicate = valueFactory
.createIRI(
buildURI(BASE_VOCAB_NS, rel.getType().name(), namespaces));
IRI object = valueFactory.createIRI(rel.getEndNode().getProperty("uri").toString());
writer.handleStatement(valueFactory.createStatement(subject, predicate, object));
>>>>>>>
processRelationship(namespaces, writer, valueFactory, BASE_VOCAB_NS, rel);
<<<<<<<
@Path("/rdfonto")
@Produces({"application/rdf+xml", "text/plain", "text/turtle", "text/n3",
"application/trig", "application/ld+json", "application/n-quads"})
=======
@Path("/ontonrdf")
@Produces({"application/rdf+xml", "text/plain", "text/turtle", "text/n3", "application/trix",
"application/x-trig",
"application/ld+json"})
>>>>>>>
@Path("/ontonrdf")
@Produces({"application/rdf+xml", "text/plain", "text/turtle", "text/n3",
"application/trig", "application/ld+json", "application/n-quads"}) |
<<<<<<<
public static final Label RESOURCE = Label.label("Resource");
public static final String[] EMPTY_ARRAY = new String[0];
Cache<String, Node> nodeCache;
public DirectStatementLoader(GraphDatabaseService db, long batchSize, long nodeCacheSize,
int handleUrls, int handleMultivals, Set<String> multivalPropUriList,
boolean keepCustomDataTypes,
Set<String> customDataTypedPropList, Set<String> predicateExclusionList,
boolean typesToLabels, boolean klt,
String languageFilter, Log l) {
super(db, languageFilter, handleUrls, handleMultivals, multivalPropUriList, keepCustomDataTypes,
customDataTypedPropList, predicateExclusionList, klt,
typesToLabels, batchSize);
nodeCache = CacheBuilder.newBuilder()
.maximumSize(nodeCacheSize)
.build();
log = l;
}
@Override
public void endRDF() throws RDFHandlerException {
Util.inTx(graphdb, this);
totalTriplesMapped += mappedTripleCounter;
if (handleUris == 0) {
addNamespaceNode();
=======
public static final Label RESOURCE = Label.label("Resource");
public static final String[] EMPTY_ARRAY = new String[0];
Cache<String, Node> nodeCache;
public DirectStatementLoader(GraphDatabaseService db, long batchSize, long nodeCacheSize,
int handleUrls, int handleMultivals, Set<String> multivalPropUriList,
Set<String> predicateExclusionList, boolean typesToLabels, boolean klt,
String languageFilter, boolean applyNeo4jNaming, Log l) {
super(db, languageFilter, handleUrls, handleMultivals, multivalPropUriList,
predicateExclusionList, klt,
typesToLabels, applyNeo4jNaming, batchSize);
nodeCache = CacheBuilder.newBuilder()
.maximumSize(nodeCacheSize)
.build();
log = l;
}
@Override
public void endRDF() throws RDFHandlerException {
Util.inTx(graphdb, this);
totalTriplesMapped += mappedTripleCounter;
if (handleUris == 0) {
addNamespaceNode();
>>>>>>>
public static final Label RESOURCE = Label.label("Resource");
public static final String[] EMPTY_ARRAY = new String[0];
Cache<String, Node> nodeCache;
public DirectStatementLoader(GraphDatabaseService db, long batchSize, long nodeCacheSize,
int handleUrls, int handleMultivals, Set<String> multivalPropUriList,
boolean keepCustomDataTypes,
Set<String> customDataTypedPropList, Set<String> predicateExclusionList,
boolean typesToLabels, boolean klt,
String languageFilter, boolean applyNeo4jNaming, Log l) {
super(db, languageFilter, handleUrls, handleMultivals, multivalPropUriList, keepCustomDataTypes,
customDataTypedPropList, predicateExclusionList, klt,
typesToLabels, applyNeo4jNaming, batchSize);
nodeCache = CacheBuilder.newBuilder()
.maximumSize(nodeCacheSize)
.build();
log = l;
}
@Override
public void endRDF() throws RDFHandlerException {
Util.inTx(graphdb, this);
totalTriplesMapped += mappedTripleCounter;
if (handleUris == 0) {
addNamespaceNode(); |
<<<<<<<
=======
import java.io.BufferedWriter;
>>>>>>>
import java.io.BufferedWriter;
<<<<<<<
* Created by jbarrasa on 21/03/2016.
* <p>
* RDF importer based on: 1. DatatypeProperties become node attributes 2. rdf:type relationships are
* transformed into labels on the subject node 3. rdf:type relationships generate :Class nodes on
* the object
=======
* Created by jbarrasa on 21/03/2016. <p> RDF importer based on: 1. Instancdes of DatatypeProperties
* become node attributes 2. rdf:type relationships are transformed either into labels or
* relationships to nodes representing the class 3. Instances of ObjectProperties become
* relationships ( See https://jbarrasa.com/2016/06/07/importing-rdf-data-into-neo4j/ )
>>>>>>>
* Created by jbarrasa on 21/03/2016. <p> RDF importer based on: 1. Instancdes of DatatypeProperties
* become node attributes 2. rdf:type relationships are transformed either into labels or
* relationships to nodes representing the class 3. Instances of ObjectProperties become
* relationships ( See https://jbarrasa.com/2016/06/07/importing-rdf-data-into-neo4j/ ) |
<<<<<<<
private static final String ARCHIVA_TEST_ARTIFACT_ID = "archiva-xmlrpc-test";
private static final String ARCHIVA_TEST_GROUP_ID = "org.apache.archiva";
private MockControl metadataResolverControl;
private MetadataResolver metadataResolver;
=======
private MockControl repoBrowsingControl;
private RepositoryBrowsing repoBrowsing;
private static final String ARCHIVA_TEST_ARTIFACT_ID = "archiva-xmlrpc-test";
private static final String ARCHIVA_TEST_GROUP_ID = "org.apache.archiva";
>>>>>>>
private static final String ARCHIVA_TEST_ARTIFACT_ID = "archiva-xmlrpc-test";
private static final String ARCHIVA_TEST_GROUP_ID = "org.apache.archiva";
private MockControl metadataResolverControl;
private MetadataResolver metadataResolver;
<<<<<<<
searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
results );
ProjectVersionMetadata model = new ProjectVersionMetadata();
model.setId( "1.0" );
MavenProjectFacet facet = new MavenProjectFacet();
facet.setPackaging( "jar" );
model.addFacet( facet );
metadataResolverControl.expectAndReturn(
metadataResolver.getProjectVersion( "repo1.mirror", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID,
"1.0" ), model );
=======
searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ), results );
ArchivaProjectModel model = new ArchivaProjectModel();
model.setGroupId( ARCHIVA_TEST_GROUP_ID );
model.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
model.setVersion( "1.0" );
model.setPackaging( "jar" );
repoBrowsingControl.expectAndReturn( repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), model );
repoBrowsingControl.expectAndReturn( repoBrowsing.getRepositoryId( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID,
ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), "repo1.mirror" );
>>>>>>>
searchControl.expectAndDefaultReturn( search.search( "", observableRepoIds, "archiva", limits, null ),
results );
ProjectVersionMetadata model = new ProjectVersionMetadata();
model.setId( "1.0" );
MavenProjectFacet facet = new MavenProjectFacet();
facet.setPackaging( "jar" );
model.addFacet( facet );
metadataResolverControl.expectAndReturn(
metadataResolver.getProjectVersion( "repo1.mirror", ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID,
"1.0" ), model );
<<<<<<<
ArchivaArtifact artifact =
new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0", "", "jar", "test-repo" );
=======
ArchivaArtifact artifact = new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0", "", "jar", "test-repo" );
>>>>>>>
ArchivaArtifact artifact =
new ArchivaArtifact( ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0", "", "jar", "test-repo" );
<<<<<<<
{
String repoId = "repo1.mirror";
ProjectVersionMetadata model = new ProjectVersionMetadata();
model.setId( "1.0" );
org.apache.archiva.metadata.model.Dependency dependency = new org.apache.archiva.metadata.model.Dependency();
dependency.setGroupId( "org.apache.commons" );
=======
{
List<String> observableRepoIds = new ArrayList<String>();
observableRepoIds.add( "repo1.mirror" );
observableRepoIds.add( "public.releases" );
ArchivaProjectModel model = new ArchivaProjectModel();
model.setGroupId( ARCHIVA_TEST_GROUP_ID );
model.setArtifactId( ARCHIVA_TEST_ARTIFACT_ID );
model.setVersion( "1.0" );
org.apache.maven.archiva.model.Dependency dependency = new org.apache.maven.archiva.model.Dependency();
dependency.setGroupId( "commons-logging" );
>>>>>>>
{
String repoId = "repo1.mirror";
ProjectVersionMetadata model = new ProjectVersionMetadata();
model.setId( "1.0" );
org.apache.archiva.metadata.model.Dependency dependency = new org.apache.archiva.metadata.model.Dependency();
dependency.setGroupId( "org.apache.commons" );
<<<<<<<
String repoId = "repo1.mirror";
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), Collections.singletonList( repoId ) );
metadataResolverControl.expectAndReturn(
metadataResolver.getProjectVersion( repoId, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ),
null );
=======
List<String> observableRepoIds = new ArrayList<String>();
observableRepoIds.add( "repo1.mirror" );
observableRepoIds.add( "public.releases" );
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), observableRepoIds );
repoBrowsingControl.expectAndThrow(
repoBrowsing.selectVersion( "", observableRepoIds, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ), new ObjectNotFoundException( "Artifact does not exist." ) );
>>>>>>>
String repoId = "repo1.mirror";
userReposControl.expectAndReturn( userRepos.getObservableRepositories(), Collections.singletonList( repoId ) );
metadataResolverControl.expectAndReturn(
metadataResolver.getProjectVersion( repoId, ARCHIVA_TEST_GROUP_ID, ARCHIVA_TEST_ARTIFACT_ID, "1.0" ),
null );
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>> |
<<<<<<<
import cn.annoreg.core.RegistrationClass;
import cn.annoreg.mc.RegCommand;
import cn.liutils.api.command.LICommandBase;
=======
import cn.liutils.template.command.LICommandBase;
>>>>>>>
import cn.annoreg.core.RegistrationClass;
import cn.annoreg.mc.RegCommand;
import cn.liutils.template.command.LICommandBase; |
<<<<<<<
=======
import cn.academy.misc.tutorial.ACTutorial;
import cn.academy.misc.tutorial.Condition;
import cn.academy.support.BlockConverterBase;
>>>>>>>
import cn.academy.support.BlockConverterBase; |
<<<<<<<
@Override
public void preInit() {
EventHandlerClient.init();
EventHandlerServer.init();
}
=======
>>>>>>>
@Override
public void preInit() {
EventHandlerClient.init();
EventHandlerServer.init();
} |
<<<<<<<
import java.util.IdentityHashMap;
=======
import java.util.HashSet;
>>>>>>>
import java.util.IdentityHashMap;
import java.util.HashSet; |
<<<<<<<
import io.realm.log.RealmLogger;
=======
import io.realm.log.LogLevel;
>>>>>>>
<<<<<<<
=======
public void weakReferenceListener() throws InterruptedException {
final AtomicInteger weakCounter = new AtomicInteger(0);
final AtomicInteger strongCounter = new AtomicInteger(0);
final Realm realm = looperThread.realm;
// Setups weak listener.
RealmChangeListener<Realm> weakListener = new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm object) {
weakCounter.incrementAndGet();
}
};
realm.handlerController.addChangeListenerAsWeakReference(weakListener);
assertEquals(1, realm.handlerController.weakChangeListeners.size());
// This is not a weak listener so will be called. When this is triggered the weak references have not been
// removed yet. So make another change to ensure that they really are removed before validating.
realm.addChangeListener(new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm object) {
int count = strongCounter.incrementAndGet();
if (count == 1) {
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
} else if (count == 2) {
assertEquals(0, weakCounter.get());
assertEquals(0, realm.handlerController.weakChangeListeners.size());
looperThread.testComplete();
}
}
});
// Hack: There is no guaranteed way to release the WeakReference, just clear it.
for (WeakReference<RealmChangeListener<? extends BaseRealm>> weakRef : realm.handlerController.weakChangeListeners) {
weakRef.clear();
}
// Triggers change listeners.
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
}
// Tests that that a WeakReferenceListener can be removed.
// This test is not a proper GC test, but just ensures that listeners can be removed from the list of weak listeners
// without throwing an exception.
@Test
@RunTestInLooperThread
public void removingWeakReferenceListener() throws InterruptedException {
final AtomicInteger counter = new AtomicInteger(0);
final Realm realm = looperThread.realm;
RealmChangeListener<Realm> listenerA = new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm object) {
counter.incrementAndGet();
}
};
RealmChangeListener<Realm> listenerB = new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm object) {
assertEquals(0, counter.get());
assertEquals(1, realm.handlerController.weakChangeListeners.size());
looperThread.testComplete();
}
};
realm.handlerController.addChangeListenerAsWeakReference(listenerA);
// There is no guaranteed way to release the WeakReference,
// just clear it.
for (WeakReference<RealmChangeListener<? extends BaseRealm>> weakRef : realm.handlerController.weakChangeListeners) {
weakRef.clear();
}
realm.handlerController.addChangeListenerAsWeakReference(listenerB);
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
}
@Test
@RunTestInLooperThread
>>>>>>>
<<<<<<<
=======
// FIXME check if the SharedRealm Changed in handleAsyncTransactionCompleted and reenable this test.
// We precisely depend on the order of triggering change listeners right now.
// So it should be:
// 1. Synced object listener
// 2. Synced results listener
// 3. Global listener
// Async listeners are not concerned by this test. Since they are triggered by different event and no advance read
// involved.
// If this case fails on your code, think twice before changing the test!
// https://github.com/realm/realm-java/issues/2408 is related to this test!
@Test
@Ignore("Listener on Realm might be trigger more times, ignore for now")
@RunTestInLooperThread
public void callingOrdersOfListeners() {
final Realm realm = looperThread.realm;
final AtomicInteger count = new AtomicInteger(0);
final RealmChangeListener<RealmResults<AllTypes>> syncedResultsListener =
new RealmChangeListener<RealmResults<AllTypes>>() {
@Override
public void onChange(RealmResults<AllTypes> element) {
// First called.
assertEquals(0, count.getAndIncrement());
}
};
final RealmChangeListener<AllTypes> syncedObjectListener = new RealmChangeListener<AllTypes>() {
@Override
public void onChange(AllTypes element) {
// Second called.
assertEquals(1, count.getAndIncrement());
}
};
final RealmChangeListener<Realm> globalListener = new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm element) {
// Third called.
assertEquals(2, count.getAndIncrement());
looperThread.testComplete();
}
};
realm.beginTransaction();
final AllTypes allTypes = realm.createObject(AllTypes.class);
realm.commitTransaction();
// We need to create one objects first and let the pass the first change event.
final RealmChangeListener<Realm> initListener = new RealmChangeListener<Realm>() {
@Override
public void onChange(Realm element) {
looperThread.postRunnable(new Runnable() {
@Override
public void run() {
// Clears the change listeners.
realm.removeAllChangeListeners();
// Now we can start testing.
allTypes.addChangeListener(syncedObjectListener);
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
results.addChangeListener(syncedResultsListener);
realm.addChangeListener(globalListener);
// Now we trigger those listeners.
realm.executeTransactionAsync(new Realm.Transaction() {
@Override
public void execute(Realm realm) {
AllTypes allTypes = realm.where(AllTypes.class).findFirst();
assertNotNull(allTypes);
allTypes.setColumnLong(42);
}
});
}
});
}
};
realm.addChangeListener(initListener);
}
>>>>>>>
<<<<<<<
// Step 3: Delete object which will make the results contain an invalid object at this moment
// Right Event Queue: |Reattach | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/Reattach|
=======
// Step 3: Deletes object which will make the results contain an invalid object at this moment.
// Right Event Queue: |LOCAL_COMMIT | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/LOCAL_COMMIT|
>>>>>>>
// Step 3: Deletes object which will make the results contain an invalid object at this moment
// Right Event Queue: |Reattach | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/Reattach|
<<<<<<<
// Step 4: Delete object which will make the results contain a invalid object at this moment
// Right Event Queue: |Reattach | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/Reattach|
=======
// Step 4: Deletes object which will make the results contain a invalid object at this moment.
// Right Event Queue: |LOCAL_COMMIT | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/LOCAL_COMMIT|
>>>>>>>
// Step 4: Deletes object which will make the results contain a invalid object at this moment
// Right Event Queue: |Reattach | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/Reattach|
<<<<<<<
// See https://github.com/realm/realm-android-adapters/issues/48
// Step 1: Populate the db
// Step 2: Create a async query
// Step 3: Add listener to the async results
// Event Queue: |async callback| <- TOP
// Step 4: Delete object which will make the results contain a invalid object at this moment
// Right calling order: |Reattach | Wrong order: |async callback| <- TOP
// |async callback| |Reattach |
=======
// See https://github.com/realm/realm-android-adapters/issues/48.
// Step 1: Populates the db.
// Step 2: Creates a async query, and pauses it.
// Step 3: Posts a runnable to caller thread.
// Event Queue: |Posted Runnable| <- TOP
// Step 4: Deletes object which will make the results contain a invalid object at this moment.
// Right Event Queue: |LOCAL_COMMIT | Wrong Event Queue: |Posted Runnable | <- TOP
// |Posted Runnable| |REALM_CHANGED/LOCAL_COMMIT|
>>>>>>>
// See https://github.com/realm/realm-android-adapters/issues/48
// Step 1: Populate the db
// Step 2: Create a async query
// Step 3: Add listener to the async results
// Event Queue: |async callback| <- TOP
// Step 4: Deletes object which will make the results contain a invalid object at this moment
// Right calling order: |Reattach | Wrong order: |async callback| <- TOP
// |async callback| |Reattach | |
<<<<<<<
=======
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.hateoas.ResourceSupport;
>>>>>>>
import lombok.Data;
import lombok.EqualsAndHashCode;
<<<<<<<
public class QualityProfileResource {
private Long id;
=======
@EqualsAndHashCode(callSuper = true)
@Data
public class QualityProfileResource extends ResourceSupport {
>>>>>>>
@EqualsAndHashCode
@Data
public class QualityProfileResource {
private Long id;
<<<<<<<
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProfileName() {
return profileName;
}
public void setProfileName(String profileName) {
this.profileName = profileName;
}
public List<MetricDTO> getMetrics() {
return metrics;
}
public void setMetrics(List<MetricDTO> metrics) {
this.metrics = metrics;
}
=======
>>>>>>> |
<<<<<<<
private static RealmConfiguration defaultConfiguration;
private static final String INCORRECT_THREAD_MESSAGE = "Realm access from incorrect thread. Realm objects can only be accessed on the thread they where created.";
=======
// Maps ids to a boolean set to true if the Realm is open. This is only needed by deleteRealmFile
private static final Map<String, AtomicInteger> openRealms = new ConcurrentHashMap<String, AtomicInteger>();
private static final String INCORRECT_THREAD_MESSAGE = "Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created.";
>>>>>>>
private static RealmConfiguration defaultConfiguration;
private static final String INCORRECT_THREAD_MESSAGE = "Realm access from incorrect thread. Realm objects can only be accessed on the thread they were created.";
<<<<<<<
private final List<WeakReference<RealmChangeListener>> changeListeners = new ArrayList<WeakReference<RealmChangeListener>>();
protected RealmProxyMediator proxyMediator;
=======
private final List<WeakReference<RealmChangeListener>> changeListeners =
new CopyOnWriteArrayList<WeakReference<RealmChangeListener>>();
private static RealmProxyMediator proxyMediator = getDefaultMediator();
>>>>>>>
private final List<WeakReference<RealmChangeListener>> changeListeners =
new CopyOnWriteArrayList<WeakReference<RealmChangeListener>>();
protected RealmProxyMediator proxyMediator;
<<<<<<<
realmPath.equals(canonicalPath) // It's the right realm
&& !handler.hasMessages(REALM_CHANGED) // The right message
&& handler.getLooper().getThread().isAlive() // The receiving thread is alive
&& !handler.equals(this.handler) // Don't notify yourself
=======
realmPath.equals(canonicalPath) // It's the right realm
&& !handler.hasMessages(REALM_CHANGED) // The right message
&& handler.getLooper().getThread().isAlive() // The receiving thread is alive
>>>>>>>
realmPath.equals(canonicalPath) // It's the right realm
&& !handler.hasMessages(REALM_CHANGED) // The right message
&& handler.getLooper().getThread().isAlive() // The receiving thread is alive
<<<<<<<
// Get the canonical path for a given file
=======
/**
* Override the standard behavior of all classes extended RealmObject being part of the schema.
* Use this method to define the schema as only the classes given here.
*
* This class must be called before calling {@link #getInstance(android.content.Context)}
*
* If {@code null} is given as parameter, the Schema is reset to use all known classes.
*
*/
@SafeVarargs
static void setSchema(Class<? extends RealmObject>... schemaClass) {
if (schemaClass != null) {
// Filter default schema
proxyMediator = new FilterableMediator(getDefaultMediator(), Arrays.asList(schemaClass));
} else if (proxyMediator instanceof FilterableMediator) {
// else reset filter if needed
proxyMediator = ((FilterableMediator) proxyMediator).getOriginalMediator();
}
}
>>>>>>>
// Get the canonical path for a given file |
<<<<<<<
public static Simple copyOrUpdate(Realm realm, Simple object, boolean update, Map<RealmObject,RealmObjectProxy> cache) {
=======
public static Simple copyOrUpdate(Realm realm, Simple object, boolean update, Map<RealmObject,RealmObject> cache) {
if (object.realm != null && object.realm.getId() == realm.getId()) {
return object;
}
>>>>>>>
public static Simple copyOrUpdate(Realm realm, Simple object, boolean update, Map<RealmObject,RealmObjectProxy> cache) {
if (object.realm != null && object.realm.getId() == realm.getId()) {
return object;
} |
<<<<<<<
=======
public Query is(long value) {
return query(getQuery().equal(columnIndex, value));
}
public long minimum() {
return 0;
}
>>>>>>>
public long minimum() {
return 0;
} |
<<<<<<<
public void insertBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data){
=======
public void insertBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data) {
>>>>>>>
public void insertBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data) {
<<<<<<<
public void insertBinaryByteArray(long columnIndex, long rowIndex, byte[] data){
nativeInsertBinary(nativePtr, columnIndex, rowIndex, data);
}
protected native void nativeInsertBinary(long nativePtr, long columnIndex, long rowIndex, byte[] data);
public void insertSubTable(long columnIndex, long rowIndex){
nativeInsertSubTable(nativePtr, columnIndex, rowIndex);
=======
public void insertBinaryByteArray(long columnIndex, long rowIndex, byte[] data) {
nativeInsertBinary(nativePtr, columnIndex, rowIndex, data);
>>>>>>>
public void insertBinaryByteArray(long columnIndex, long rowIndex, byte[] data) {
nativeInsertBinary(nativePtr, columnIndex, rowIndex, data);
<<<<<<<
public ByteBuffer getBinaryByteBuffer(long columnIndex, long rowIndex){
=======
public ByteBuffer getBinaryByteBuffer(long columnIndex, long rowIndex) {
>>>>>>>
public ByteBuffer getBinaryByteBuffer(long columnIndex, long rowIndex) {
<<<<<<<
public byte[] getBinaryByteArray(long columnIndex, long rowIndex){
return nativeGetByteArray(nativePtr, columnIndex, rowIndex);
}
protected native byte[] nativeGetByteArray(long nativePtr, long columnIndex, long rowIndex);
public Mixed getMixed(long columnIndex, long rowIndex){
=======
public byte[] getBinaryByteArray(long columnIndex, long rowIndex) {
return nativeGetByteArray(nativePtr, columnIndex, rowIndex);
}
protected native byte[] nativeGetByteArray(long nativePtr, long columnIndex, long rowIndex);
public Mixed getMixed(long columnIndex, long rowIndex) {
>>>>>>>
public byte[] getBinaryByteArray(long columnIndex, long rowIndex) {
return nativeGetByteArray(nativePtr, columnIndex, rowIndex);
}
protected native byte[] nativeGetByteArray(long nativePtr, long columnIndex, long rowIndex);
public Mixed getMixed(long columnIndex, long rowIndex) {
<<<<<<<
/**
*
* Note: The subtable returned will have to be closed again after use.
* You can let javas garbage collector handle that or better yet call close()
* after use.
*
* @param columnIndex column index of the cell
* @param rowIndex row index of the cell
* @return TableBase the subtable at the requested cell
*/
public TableBase getSubTable(long columnIndex, long rowIndex){
=======
public TableBase getSubTable(long columnIndex, long rowIndex) {
>>>>>>>
/**
*
* Note: The subtable returned will have to be closed again after use.
* You can let javas garbage collector handle that or better yet call close()
* after use.
*
* @param columnIndex column index of the cell
* @param rowIndex row index of the cell
* @return TableBase the subtable at the requested cell
*/
public TableBase getSubTable(long columnIndex, long rowIndex) {
<<<<<<<
*/
public void setBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data){
if(data == null)
=======
*/
public void setBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data) {
if (data == null)
>>>>>>>
*/
public void setBinaryByteBuffer(long columnIndex, long rowIndex, ByteBuffer data) {
if (data == null)
<<<<<<<
public void setBinaryByteArray(long columnIndex, long rowIndex, byte[] data){
if(data == null)
throw new NullPointerException("Null Array");
nativeSetByteArray(nativePtr, columnIndex, rowIndex, data);
}
protected native void nativeSetByteArray(long nativePtr, long columnIndex, long rowIndex, byte[] data);
/**
=======
public void setBinaryByteArray(long columnIndex, long rowIndex, byte[] data) {
if (data == null)
throw new NullPointerException("Null Array");
nativeSetByteArray(nativePtr, columnIndex, rowIndex, data);
}
protected native void nativeSetByteArray(long nativePtr, long columnIndex, long rowIndex, byte[] data);
/**
>>>>>>>
public void setBinaryByteArray(long columnIndex, long rowIndex, byte[] data) {
if (data == null)
throw new NullPointerException("Null Array");
nativeSetByteArray(nativePtr, columnIndex, rowIndex, data);
}
protected native void nativeSetByteArray(long nativePtr, long columnIndex, long rowIndex, byte[] data);
/** |
<<<<<<<
=======
import java.util.HashSet;
import java.util.Iterator;
>>>>>>>
import java.util.Iterator;
<<<<<<<
private static RealmConfiguration defaultConfiguration;
private static final String APT_NOT_EXECUTED_MESSAGE = "Annotation processor may not have been executed.";
=======
// Maps ids to a boolean set to true if the Realm is open. This is only needed by deleteRealmFile
private static final Map<String, AtomicInteger> openRealms = new ConcurrentHashMap<String, AtomicInteger>();
>>>>>>>
private static RealmConfiguration defaultConfiguration;
private static final String APT_NOT_EXECUTED_MESSAGE = "Annotation processor may not have been executed.";
<<<<<<<
private final RealmJson realmJson = getRealmJson();
private final Map<Class<?>, String> simpleClassNames = new HashMap<Class<?>, String>(); // Map between original class and their class name
private final Map<String, Class<?>> generatedClasses = new HashMap<String, Class<?>>(); // Map between generated class names and their implementation
private final Map<Class<?>, Constructor> constructors = new HashMap<Class<?>, Constructor>();
private final Map<Class<?>, Method> initTableMethods = new HashMap<Class<?>, Method>();
private final Map<Class<?>, Method> insertOrUpdateMethods = new HashMap<Class<?>, Method>();
private final Map<Class<?>, Constructor> generatedConstructors = new HashMap<Class<?>, Constructor>();
// Maps classes to the name of the proxied class. Examples: Dog.class -> Dog, DogRealmProxy -> Dog
private final Map<Class<?>, String> proxiedClassNames = new HashMap<Class<?>, String>();
private final List<RealmChangeListener> changeListeners = new ArrayList<RealmChangeListener>();
private final Map<Class<?>, Table> tables = new HashMap<Class<?>, Table>();
=======
private final List<WeakReference<RealmChangeListener>> changeListeners = new ArrayList<WeakReference<RealmChangeListener>>();
private static RealmProxyMediator proxyMediator = getDefaultMediator();
>>>>>>>
private final List<WeakReference<RealmChangeListener>> changeListeners = new ArrayList<WeakReference<RealmChangeListener>>();
private static RealmProxyMediator proxyMediator = getDefaultMediator();
<<<<<<<
private static void initializeRealm(Realm realm, RealmConfiguration config) {
Class<?> validationClass;
try {
validationClass = Class.forName("io.realm.ValidationList");
} catch (ClassNotFoundException e) {
throw new RealmException("Could not find the generated ValidationList class: " + APT_NOT_EXECUTED_MESSAGE);
}
Method getProxyClassesMethod;
try {
getProxyClassesMethod = validationClass.getMethod("getProxyClasses");
} catch (NoSuchMethodException e) {
throw new RealmException("Could not find the getProxyClasses method in the ValidationList class: " + APT_NOT_EXECUTED_MESSAGE);
}
List<String> proxyClasses;
try {
proxyClasses = (List<String>) getProxyClassesMethod.invoke(null);
} catch (IllegalAccessException e) {
throw new RealmException("Could not execute the getProxyClasses method in the ValidationList class: " + APT_NOT_EXECUTED_MESSAGE);
} catch (InvocationTargetException e) {
throw new RealmException("An exception was thrown in the getProxyClasses method in the ValidationList class: " + APT_NOT_EXECUTED_MESSAGE);
}
// Custom schema overrides any schema already defined
Set<Class<? extends RealmObject>> customSpec = config.getSchema();
if (customSpec.size() > 0) {
proxyClasses = new ArrayList<String>();
for (Class<? extends RealmObject> clazz : customSpec) {
proxyClasses.add(clazz.getName());
}
}
=======
private static void initializeRealm(Realm realm) {
>>>>>>>
private static void initializeRealm(Realm realm, RealmConfiguration config) {
<<<<<<<
for (String className : proxyClasses) {
String[] splitted = className.split("\\.");
String modelClassName = splitted[splitted.length - 1];
String generatedClassName = getProxyClassName(modelClassName);
// Verify that there is a proxy class for each supported model class
Class<?> generatedClass;
try {
generatedClass = Class.forName(generatedClassName);
} catch (ClassNotFoundException e) {
throw new RealmException("Could not find the generated " + generatedClassName + " class: " + APT_NOT_EXECUTED_MESSAGE);
}
=======
for (Class<? extends RealmObject> modelClass : proxyMediator.getModelClasses()) {
String modelClassName = modelClass.getSimpleName();
>>>>>>>
for (Class<? extends RealmObject> modelClass : proxyMediator.getModelClasses()) {
<<<<<<<
boolean sortAscending1, String fieldName2,
boolean sortAscending2) {
return allObjectsSorted(clazz, new String[]{fieldName1, fieldName2}, new boolean[]{sortAscending1,
=======
boolean sortAscending1, String fieldName2,
boolean sortAscending2) {
return allObjectsSorted(clazz, new String[]{fieldName1, fieldName2}, new boolean[]{sortAscending1,
>>>>>>>
boolean sortAscending1, String fieldName2,
boolean sortAscending2) {
return allObjectsSorted(clazz, new String[]{fieldName1, fieldName2}, new boolean[]{sortAscending1,
<<<<<<<
=======
*
* @throws java.lang.IllegalStateException if trying to compact a Realm that is already open.
>>>>>>>
*
* @throws java.lang.IllegalStateException if trying to compact a Realm that is already open.
<<<<<<<
=======
*
* @throws java.lang.IllegalStateException if trying to compact a Realm that is already open.
>>>>>>>
*
* @throws java.lang.IllegalStateException if trying to compact a Realm that is already open.
<<<<<<<
=======
/**
* Override the standard behavior of all classes extended RealmObject being part of the schema.
* Use this method to define the schema as only the classes given here.
*
* This class must be called before calling {@link #getInstance(android.content.Context)}
*ø
* If {@code null} is given as parameter, the Schema is reset to use all known classes.
*
*/
@SafeVarargs
static void setSchema(Class<? extends RealmObject>... schemaClass) {
if (schemaClass != null) {
// Filter default schema
proxyMediator = new FilterableMediator(getDefaultMediator(), Arrays.asList(schemaClass));
} else if (proxyMediator instanceof FilterableMediator) {
// else reset filter if needed
proxyMediator = ((FilterableMediator) proxyMediator).getOriginalMediator();
}
}
>>>>>>>
/**
* Override the standard behavior of all classes extended RealmObject being part of the schema.
* Use this method to define the schema as only the classes given here.
*
* This class must be called before calling {@link #getInstance(android.content.Context)}
*ø
* If {@code null} is given as parameter, the Schema is reset to use all known classes.
*
*/
private static void setSchema(Collection<Class<? extends RealmObject>> classes) {
if (classes != null && classes.size() > 0) {
// Filter default schema
proxyMediator = new FilterableMediator(getDefaultMediator(), classes);
} else if (proxyMediator instanceof FilterableMediator) {
// else reset filter if needed
proxyMediator = ((FilterableMediator) proxyMediator).getOriginalMediator();
}
} |
<<<<<<<
public long getNativePointer () {
return nativePtr;
}
private native long createNativeWithImplicitTransactions(long nativeReplicationPtr, byte[] key);
=======
private native long createNativeWithImplicitTransactions(long nativeReplicationPtr, int durability, byte[] key);
>>>>>>>
private native long createNativeWithImplicitTransactions(long nativeReplicationPtr, int durability, byte[] key);
public long getNativePointer () {
return nativePtr;
} |
<<<<<<<
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import java.lang.String;
=======
>>>>>>>
<<<<<<<
=======
import java.util.EnumSet;
import java.util.HashMap;
>>>>>>> |
<<<<<<<
void validateQuery() {
if (! queryValidated) { // If not yet validated, check if syntax is valid
=======
private void validateQuery() {
if (!queryValidated) { // If not yet validated, checks if syntax is valid
>>>>>>>
void validateQuery() {
if (! queryValidated) { // If not yet validated, checks if syntax is valid
<<<<<<<
=======
// Query TableView.
public TableQuery tableview(TableView tv) {
nativeTableview(nativePtr, tv.nativePtr);
return this;
}
>>>>>>>
<<<<<<<
=======
* Performs a find query then handover the resulted Row (ready to be imported by another thread/shared_group).
*
* @param sharedRealm current {@link SharedRealm }from which to operate the query.
* @param ptrQuery query to run the the find against.
* @return pointer to the handover result (table_view).
*/
public static long findWithHandover(SharedRealm sharedRealm, long ptrQuery) {
// Execute the disposal of abandoned realm objects each time a new realm object is created
return nativeFindWithHandover(sharedRealm.getNativePtr(), ptrQuery, 0);
}
public TableView findAll(long start, long end, long limit) {
validateQuery();
long nativeViewPtr = nativeFindAll(nativePtr, start, end, limit);
return new TableView(this.context, this.table, nativeViewPtr, this);
}
public TableView findAll() {
validateQuery();
long nativeViewPtr = nativeFindAll(nativePtr, 0, Table.INFINITE, Table.INFINITE);
return new TableView(this.context, this.table, nativeViewPtr, this);
}
// Handovers find* methods.
// this will use a background SharedGroup to import the query (using the handover object)
// run the query, and return the table view to the caller SharedGroup using the handover object.
public static long findAllWithHandover(SharedRealm sharedRealm, long ptrQuery) throws BadVersionException {
return nativeFindAllWithHandover(sharedRealm.getNativePtr(), ptrQuery, 0, Table.INFINITE, Table.INFINITE);
}
public static long findDistinctWithHandover(SharedRealm sharedRealm, long ptrQuery, long columnIndex) throws BadVersionException {
return nativeGetDistinctViewWithHandover(sharedRealm.getNativePtr(), ptrQuery, columnIndex);
}
public static long findAllSortedWithHandover(SharedRealm sharedRealm, long ptrQuery, long columnIndex, Sort sortOrder) throws BadVersionException {
return nativeFindAllSortedWithHandover(sharedRealm.getNativePtr(), ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndex, sortOrder.getValue());
}
public static long findAllMultiSortedWithHandover(SharedRealm sharedRealm, long ptrQuery, long[] columnIndices, Sort[] sortOrders) throws BadVersionException {
boolean[] ascendings = getNativeSortOrderValues(sortOrders);
return nativeFindAllMultiSortedWithHandover(sharedRealm.getNativePtr(), ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndices, ascendings);
}
public static long[] batchUpdateQueries(SharedRealm sharedRealm, long[] handoverQueries, long[][] parameters,
long[][] queriesParameters, boolean[][] multiSortOrder)
throws BadVersionException {
return nativeBatchUpdateQueries(sharedRealm.getNativePtr(), handoverQueries, parameters, queriesParameters,
multiSortOrder);
}
/**
* Imports a TableView from a worker thread to the caller thread.
*
* @param handoverPtr pointer to the handover object
* @param sharedRealm the SharedRealm on the caller thread.
* @return the TableView on the caller thread.
* @throws BadVersionException if the worker thread and caller thread are not at the same version.
*/
public TableView importHandoverTableView(long handoverPtr, SharedRealm sharedRealm) throws BadVersionException {
long nativeTvPtr = nativeImportHandoverTableViewIntoSharedGroup(handoverPtr, sharedRealm.getNativePtr());
return new TableView(this.context, this.table, nativeTvPtr);
}
/**
>>>>>>> |
<<<<<<<
TableSpec tableSpec = new TableSpec();
tableSpec.addColumn(ColumnType.STRING, "name");
tableSpec.addColumn(ColumnType.LONG, "number");
tbl.updateFromSpec(tableSpec);
=======
tbl.addColumn(ColumnType.ColumnTypeString, "name");
tbl.addColumn(ColumnType.ColumnTypeInt, "number");
>>>>>>>
TableSpec tableSpec = new TableSpec();
tableSpec.addColumn(ColumnType.STRING, "name");
tableSpec.addColumn(ColumnType.LONG, "number");
tbl.updateFromSpec(tableSpec);
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>>
<<<<<<<
=======
>>>>>>> |
<<<<<<<
this.nativePtr = nativeCreatePersistedProperty(name, type.getNativeValue(), isPrimary, isIndexed, !isRequired);
=======
this.nativePtr = nativeCreateProperty(name, convertFromRealmFieldType(type, isRequired), isPrimary, isIndexed);
>>>>>>>
this.nativePtr = nativeCreatePersistedProperty(name, convertFromRealmFieldType(type, isRequired), isPrimary, isIndexed);
<<<<<<<
this.nativePtr = nativeCreatePersistedLinkProperty(name, type.getNativeValue(), linkedClassName);
=======
// Ignore the isRequired when creating the linking property.
int propertyType = convertFromRealmFieldType(type, false);
this.nativePtr = nativeCreateProperty(name, propertyType, linkedClassName);
>>>>>>>
// Ignore the isRequired when creating the linking property.
int propertyType = convertFromRealmFieldType(type, false);
this.nativePtr = nativeCreatePersistedLinkProperty(name, propertyType, linkedClassName);
<<<<<<<
private static native long nativeCreatePersistedProperty(
String name, int type, boolean isPrimary, boolean isIndexed, boolean isNullable);
private static native long nativeCreatePersistedLinkProperty(String name, int type, String linkedToName);
=======
private static native long nativeCreateProperty(String name, int type, boolean isPrimary, boolean isIndexed);
>>>>>>>
private static native long nativeCreatePersistedProperty(
String name, int type, boolean isPrimary, boolean isIndexed);
private static native long nativeCreatePersistedLinkProperty(String name, int type, String linkedToName); |
<<<<<<<
import io.realm.entities.CyclicType;
import io.realm.entities.CyclicTypePrimaryKey;
=======
import io.realm.entities.Cat;
>>>>>>>
import io.realm.entities.CyclicType;
import io.realm.entities.CyclicTypePrimaryKey;
import io.realm.entities.Cat; |
<<<<<<<
import com.tightdb.ColumnType;
=======
import com.tightdb.Group;
>>>>>>>
import com.tightdb.ColumnType;
import com.tightdb.Group; |
<<<<<<<
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
=======
import com.google.common.base.Throwables;
>>>>>>>
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.google.common.base.Throwables; |
<<<<<<<
public void testRealmFileDeletion() {
final String otherRealmName = "yetAnotherRealm.realm";
try {
Realm.deleteRealmFile(getContext());
fail();
} catch (Exception ignored) {
}
Realm yetAnotherRealm = Realm.getInstance(getContext(), otherRealmName);
try {
Realm.deleteRealmFile(getContext(), otherRealmName);
fail();
} catch (Exception ignored) {
}
yetAnotherRealm.close();
try {
Realm.deleteRealmFile(getContext(), otherRealmName);
} catch (Exception e) {
fail();
}
}
=======
public void testWrongKeyShouldThrow() {
final String WRONG_KEY_REALM = "wrong-key-realm.realm";
// Wrong key size
try {
Realm.getInstance(getContext(), WRONG_KEY_REALM, new byte[63]);
fail();
} catch (IllegalArgumentException ignored) {
} catch (Exception ignored) {
fail();
}
Realm.getInstance(getContext(), WRONG_KEY_REALM);
try {
Realm.getInstance(getContext(), WRONG_KEY_REALM, new byte[64]);
fail();
} catch (IllegalStateException ignored) {
} catch (Exception ignored) {
fail();
}
}
>>>>>>>
public void testRealmFileDeletion() {
final String otherRealmName = "yetAnotherRealm.realm";
try {
Realm.deleteRealmFile(getContext());
fail();
} catch (Exception ignored) {
}
Realm yetAnotherRealm = Realm.getInstance(getContext(), otherRealmName);
try {
Realm.deleteRealmFile(getContext(), otherRealmName);
fail();
} catch (Exception ignored) {
}
yetAnotherRealm.close();
try {
Realm.deleteRealmFile(getContext(), otherRealmName);
} catch (Exception e) {
fail();
}
}
public void testWrongKeyShouldThrow() {
final String WRONG_KEY_REALM = "wrong-key-realm.realm";
// Wrong key size
try {
Realm.getInstance(getContext(), WRONG_KEY_REALM, new byte[63]);
fail();
} catch (IllegalArgumentException ignored) {
} catch (Exception ignored) {
fail();
}
Realm.getInstance(getContext(), WRONG_KEY_REALM);
try {
Realm.getInstance(getContext(), WRONG_KEY_REALM, new byte[64]);
fail();
} catch (IllegalStateException ignored) {
} catch (Exception ignored) {
fail();
}
} |
<<<<<<<
// Verify that the logic for waiting for the users file dir to be come available isn't totally broken
// This is pretty hard to test, so forced to break encapsulation in this case.
@Test
public void init_waitForFilesDir() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IOException {
java.lang.reflect.Method m = Realm.class.getDeclaredMethod("checkFilesDirAvailable", Context.class);
m.setAccessible(true);
// A) Check it fails if getFilesDir is never created
Context mockContext = mock(Context.class);
when(mockContext.getFilesDir()).thenReturn(null);
try {
m.invoke(null, mockContext);
fail();
} catch (InvocationTargetException e) {
assertEquals(IllegalStateException.class, e.getCause().getClass());
}
// B) Check we return if the filesDir becomes available after a while
mockContext = mock(Context.class);
when(mockContext.getFilesDir()).then(new Answer<File>() {
int calls = 0;
File userFolder = tmpFolder.newFolder();
@Override
public File answer(InvocationOnMock invocationOnMock) throws Throwable {
calls++;
return (calls > 5) ? userFolder : null; // Start returning the correct folder after 5 attempts
}
});
assertNull(m.invoke(null, mockContext));
}
=======
@Test
@RunTestInLooperThread
public void refresh_triggerNotifications() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
final AtomicBoolean listenerCalled = new AtomicBoolean(false);
Realm realm = looperThread.realm;
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
assertEquals(0, results.size());
results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() {
@Override
public void onChange(RealmResults<AllTypes> results) {
assertEquals(1, results.size());
listenerCalled.set(true);
}
});
// Advance the Realm on a background while blocking this thread. When we refresh, it should trigger
// the listener.
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(looperThread.realmConfiguration);
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).run();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertTrue(listenerCalled.get());
looperThread.testComplete();
}
@Test
public void refresh_nonLooperThreadAdvances() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
assertEquals(0, results.size());
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(RealmTests.this.realm.getConfiguration());
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).run();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertEquals(1, results.size());
}
@Test
@RunTestInLooperThread
public void refresh_forceSynchronousNotifications() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
final AtomicBoolean listenerCalled = new AtomicBoolean(false);
Realm realm = looperThread.realm;
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync();
results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() {
@Override
public void onChange(RealmResults<AllTypes> results) {
// Will be forced synchronous
assertEquals(1, results.size());
listenerCalled.set(true);
}
});
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(looperThread.realmConfiguration);
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).start();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertTrue(listenerCalled.get());
looperThread.testComplete();
}
@Test
public void refresh_insideTransactionThrows() {
realm.beginTransaction();
try {
realm.refresh();
fail();
} catch (IllegalStateException ignored) {
}
realm.cancelTransaction();
}
>>>>>>>
// Verify that the logic for waiting for the users file dir to be come available isn't totally broken
// This is pretty hard to test, so forced to break encapsulation in this case.
@Test
public void init_waitForFilesDir() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, IOException {
java.lang.reflect.Method m = Realm.class.getDeclaredMethod("checkFilesDirAvailable", Context.class);
m.setAccessible(true);
// A) Check it fails if getFilesDir is never created
Context mockContext = mock(Context.class);
when(mockContext.getFilesDir()).thenReturn(null);
try {
m.invoke(null, mockContext);
fail();
} catch (InvocationTargetException e) {
assertEquals(IllegalStateException.class, e.getCause().getClass());
}
// B) Check we return if the filesDir becomes available after a while
mockContext = mock(Context.class);
when(mockContext.getFilesDir()).then(new Answer<File>() {
int calls = 0;
File userFolder = tmpFolder.newFolder();
@Override
public File answer(InvocationOnMock invocationOnMock) throws Throwable {
calls++;
return (calls > 5) ? userFolder : null; // Start returning the correct folder after 5 attempts
}
});
assertNull(m.invoke(null, mockContext));
}
@Test
@RunTestInLooperThread
public void refresh_triggerNotifications() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
final AtomicBoolean listenerCalled = new AtomicBoolean(false);
Realm realm = looperThread.realm;
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
assertEquals(0, results.size());
results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() {
@Override
public void onChange(RealmResults<AllTypes> results) {
assertEquals(1, results.size());
listenerCalled.set(true);
}
});
// Advance the Realm on a background while blocking this thread. When we refresh, it should trigger
// the listener.
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(looperThread.realmConfiguration);
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).run();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertTrue(listenerCalled.get());
looperThread.testComplete();
}
@Test
public void refresh_nonLooperThreadAdvances() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAll();
assertEquals(0, results.size());
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(RealmTests.this.realm.getConfiguration());
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).run();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertEquals(1, results.size());
}
@Test
@RunTestInLooperThread
public void refresh_forceSynchronousNotifications() {
final CountDownLatch bgThreadDone = new CountDownLatch(1);
final AtomicBoolean listenerCalled = new AtomicBoolean(false);
Realm realm = looperThread.realm;
RealmResults<AllTypes> results = realm.where(AllTypes.class).findAllAsync();
results.addChangeListener(new RealmChangeListener<RealmResults<AllTypes>>() {
@Override
public void onChange(RealmResults<AllTypes> results) {
// Will be forced synchronous
assertEquals(1, results.size());
listenerCalled.set(true);
}
});
new Thread(new Runnable() {
@Override
public void run() {
Realm realm = Realm.getInstance(looperThread.realmConfiguration);
realm.beginTransaction();
realm.createObject(AllTypes.class);
realm.commitTransaction();
realm.close();
bgThreadDone.countDown();
}
}).start();
TestHelper.awaitOrFail(bgThreadDone);
realm.refresh();
assertTrue(listenerCalled.get());
looperThread.testComplete();
}
@Test
public void refresh_insideTransactionThrows() {
realm.beginTransaction();
try {
realm.refresh();
fail();
} catch (IllegalStateException ignored) {
}
realm.cancelTransaction();
} |
<<<<<<<
import io.realm.RealmFieldType;
import io.realm.RealmObjectSchema;
import io.realm.RealmSchema;
=======
>>>>>>>
import io.realm.RealmObjectSchema;
import io.realm.RealmSchema; |
<<<<<<<
@Deprecated
public RealmResults<E> findAll(String fieldName, boolean sortAscending) {
TableView tableView = query.findAll();
TableView.Order order = sortAscending ? TableView.Order.ascending : TableView.Order.descending;
Long columnIndex = columns.get(fieldName);
if (columnIndex == null || columnIndex < 0) {
throw new IllegalArgumentException(String.format("Field name '%s' does not exist.", fieldName));
}
tableView.sort(columnIndex, order);
return new RealmResults<E>(realm, tableView, clazz);
}
/**
* Find all objects that fulfill the query conditions and sorted by specific field name.
*
* @param fieldName the field name to sort by.
* @param sortAscending sort ascending if <code>SORT_ORDER_ASCENDING</code>, sort descending
* if <code>SORT_ORDER_DESCENDING</code>.
* @return A {@link io.realm.RealmResults} containing objects. If no objects match the condition,
* a list with zero objects is returned.
* @throws java.lang.IllegalArgumentException if field name does not exist.
*/
=======
>>>>>>>
<<<<<<<
@Deprecated
public RealmResults<E> findAll(String fieldName) {
return findAll(fieldName, true);
}
/**
* Find all objects that fulfill the query conditions and sorted by specific field name in
* ascending order.
*
* @param fieldName the field name to sort by.
* @return A {@link io.realm.RealmResults} containing objects. If no objects match the condition,
* a list with zero objects is returned.
* @throws java.lang.IllegalArgumentException if field name does not exist.
*/
=======
>>>>>>>
<<<<<<<
return findAll(fieldName, true);
}
/**
* Find all objects that fulfill the query conditions and sorted by specific field names. The
* returned RealmResults will never be null, and you must use RealmResults.size() to check
* if no objects fulfill the condition.
*
* @param fieldNames an array of field names to sort by.
* @param sortAscending sort ascending if <code>SORT_ORDER_ASCENDING</code>, sort descending
* if <code>SORT_ORDER_DESCENDING</code>.
* @return A {@link io.realm.RealmResults} containing objects. If no objects match the condition,
* a list with zero objects is returned.
* @throws java.lang.IllegalArgumentException if a field name does not exist.
*/
@Deprecated
public RealmResults<E> findAll(String fieldNames[], boolean sortAscending[]) {
if (fieldNames == null) {
throw new IllegalArgumentException("fieldNames cannot be 'null'.");
} else if (sortAscending == null) {
throw new IllegalArgumentException("sortAscending cannot be 'null'.");
} else if (fieldNames.length == 0) {
throw new IllegalArgumentException("At least one field name must be specified.");
} else if (fieldNames.length != sortAscending.length) {
throw new IllegalArgumentException(String.format("Number of field names (%d) and sort orders (%d) does not match.", fieldNames.length, sortAscending.length));
}
if (fieldNames.length == 1) {
return findAll(fieldNames[0], sortAscending[0]);
} else {
TableView tableView = query.findAll();
List<Long> columnIndices = new ArrayList<Long>();
List<TableView.Order> orders = new ArrayList<TableView.Order>();
for (int i = 0; i < fieldNames.length; i++) {
String fieldName = fieldNames[i];
Long columnIndex = columns.get(fieldName);
if (columnIndex == null || columnIndex < 0) {
throw new IllegalArgumentException(String.format("Field name '%s' does not exist.", fieldName));
}
columnIndices.add(columnIndex);
orders.add(sortAscending[i] ? TableView.Order.ascending : TableView.Order.descending);
}
tableView.sort(columnIndices, orders);
return new RealmResults<E>(realm, tableView, clazz);
}
=======
return findAllSorted(fieldName, true);
>>>>>>>
return findAllSorted(fieldName, true);
<<<<<<<
@Deprecated
public RealmResults<E> findAll(String fieldName1, boolean sortAscending1,
String fieldName2, boolean sortAscending2) {
return findAll(new String[] {fieldName1, fieldName2}, new boolean[] {sortAscending1, sortAscending2});
}
/**
* Find all objects that fulfill the query conditions and sorted by specific field names in
* ascending order.
*
* @param fieldName1 first field name
* @param sortAscending1 sort order for first field
* @param fieldName2 second field name
* @param sortAscending2 sort order for second field
* @return A {@link io.realm.RealmResults} containing objects. If no objects match the condition,
* a list with zero objects is returned.
* @throws java.lang.IllegalArgumentException if a field name does not exist.
*/
=======
>>>>>>> |
<<<<<<<
table.addColumn(ColumnType.BINARY, "binary"); // 0
table.addColumn(ColumnType.BOOLEAN, "boolean"); // 1
table.addColumn(ColumnType.DATE, "date"); // 2
table.addColumn(ColumnType.DOUBLE, "double"); // 3
table.addColumn(ColumnType.FLOAT, "float"); // 4
table.addColumn(ColumnType.INTEGER, "long"); // 5
table.addColumn(ColumnType.MIXED, "mixed"); // 6
table.addColumn(ColumnType.STRING, "string"); // 7
table.addColumn(ColumnType.TABLE, "table"); // 8
table.add(new byte[] {0,2,3}, true, new Date(0), 123D, 123F, 123, new Mixed(123), "TestString", null);
assertEquals(" tables rows \n" +
" 0 testTable 1 \n", group.toString());
=======
table.addColumn(ColumnType.ColumnTypeBool, "boolean");
table.add(true);
Table table2 = group.getTable("another-table");
table2.addColumn(ColumnType.ColumnTypeBool, "boolean");
table2.add(true);
assertEquals(" tables rows \n" +
" 0 testTable 1 \n" +
" 1 another-table 1 \n", group.toString());
>>>>>>>
table.addColumn(ColumnType.BOOLEAN, "boolean");
table.add(true);
Table table2 = group.getTable("another-table");
table2.addColumn(ColumnType.BOOLEAN, "boolean");
table2.add(true);
assertEquals(" tables rows \n" +
" 0 testTable 1 \n" +
" 1 another-table 1 \n", group.toString());
<<<<<<<
table.addColumn(ColumnType.BINARY, "binary"); // 0
table.addColumn(ColumnType.BOOLEAN, "boolean"); // 1
table.addColumn(ColumnType.DATE, "date"); // 2
table.addColumn(ColumnType.DOUBLE, "double"); // 3
table.addColumn(ColumnType.FLOAT, "float"); // 4
table.addColumn(ColumnType.INTEGER, "long"); // 5
table.addColumn(ColumnType.MIXED, "mixed"); // 6
table.addColumn(ColumnType.STRING, "string"); // 7
table.addColumn(ColumnType.TABLE, "table"); // 8
table.add(new byte[] {0,2,3}, true, new Date(0), 123D, 123F, 123, new Mixed(123), "TestString", null);
=======
table.addColumn(ColumnType.ColumnTypeBinary, "binary"); // 0
table.addColumn(ColumnType.ColumnTypeBool, "boolean"); // 1
table.addColumn(ColumnType.ColumnTypeDate, "date"); // 2
table.addColumn(ColumnType.ColumnTypeInt, "long"); // 3
table.addColumn(ColumnType.ColumnTypeMixed, "mixed"); // 4
table.addColumn(ColumnType.ColumnTypeString, "string"); // 5
table.addColumn(ColumnType.ColumnTypeTable, "table"); // 6
>>>>>>>
table.addColumn(ColumnType.BINARY, "binary"); // 0
table.addColumn(ColumnType.BOOLEAN, "boolean"); // 1
table.addColumn(ColumnType.DATE, "date"); // 2
table.addColumn(ColumnType.INTEGER, "long"); // 3
table.addColumn(ColumnType.MIXED, "mixed"); // 4
table.addColumn(ColumnType.STRING, "string"); // 5
table.addColumn(ColumnType.TABLE, "table"); // 6 |
<<<<<<<
/*
=======
@Override
>>>>>>>
/*
@Override
<<<<<<<
*/
=======
@Override
>>>>>>>
*/
@Override
<<<<<<<
/*
=======
@Override
>>>>>>>
/*
@Override
<<<<<<<
public void adjust(long columnIndex, long value) {
=======
@Override
public void addLong(long columnIndex, long value) {
>>>>>>>
@Override
public void adjust(long columnIndex, long value) {
<<<<<<<
public long sumInt(long columnIndex){
return nativeSumInt(nativePtr, columnIndex);
=======
@Override
public long sum(long columnIndex){
return nativeSum(nativePtr, columnIndex);
>>>>>>>
@Override
public long sumInt(long columnIndex){
return nativeSumInt(nativePtr, columnIndex);
<<<<<<<
public long maximumInt(long columnIndex){
return nativeMaximumInt(nativePtr, columnIndex);
=======
@Override
public long maximum(long columnIndex){
return nativeMaximum(nativePtr, columnIndex);
>>>>>>>
@Override
public long maximumInt(long columnIndex){
return nativeMaximumInt(nativePtr, columnIndex);
<<<<<<<
public long minimumInt(long columnIndex){
return nativeMinimumInt(nativePtr, columnIndex);
=======
@Override
public long minimum(long columnIndex){
return nativeMinimum(nativePtr, columnIndex);
>>>>>>>
@Override
public long minimumInt(long columnIndex){
return nativeMinimumInt(nativePtr, columnIndex);
<<<<<<<
public double averageInt(long columnIndex) {
return nativeAverageInt(nativePtr, columnIndex);
=======
@Override
public double average(long columnIndex) {
return nativeAverage(nativePtr, columnIndex);
>>>>>>>
@Override
public double averageInt(long columnIndex) {
return nativeAverageInt(nativePtr, columnIndex); |
<<<<<<<
public void testSortOnNonExistingColumn() {
try {
RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll();
RealmResults<AllTypes> sortedList = resultList.sort("Non-existing");
fail("Column should not exist");
} catch (ArrayIndexOutOfBoundsException e) {
}
}
=======
>>>>>>>
public void testSortOnNonExistingColumn() {
try {
RealmResults<AllTypes> resultList = testRealm.where(AllTypes.class).findAll();
RealmResults<AllTypes> sortedList = resultList.sort("Non-existing");
fail("Column should not exist");
} catch (ArrayIndexOutOfBoundsException e) {
}
} |
<<<<<<<
import java.util.List;
import org.junit.Test;
import org.junit.experimental.categories.Category;
=======
import org.junit.jupiter.api.Test;
import org.springframework.hateoas.Resources;
>>>>>>>
import java.util.List;
import org.junit.jupiter.api.Test; |
<<<<<<<
private native String nativeValidateQuery(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeTableview(long nativeQueryPtr, long nativeTableViewPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeGroup(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeEndGroup(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeSubtable(long nativeQueryPtr, long columnIndex);
=======
>>>>>>>
<<<<<<<
private native void nativeParent(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeOr(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeNot(long nativeQueryPtr);
=======
>>>>>>>
<<<<<<<
private native void nativeEqual(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeNotEqual(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreater(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreaterEqual(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeLess(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeLessEqual(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeBetween(long nativeQueryPtr, long columnIndex[], long value1, long value2);
=======
>>>>>>>
<<<<<<<
private native void nativeEqual(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeNotEqual(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreater(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreaterEqual(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeLess(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeLessEqual(long nativeQueryPtr, long columnIndex[], float value);
=======
>>>>>>>
<<<<<<<
private native void nativeBetween(long nativeQueryPtr, long columnIndex[], float value1, float value2);
=======
>>>>>>>
<<<<<<<
private native void nativeEqual(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeNotEqual(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreater(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreaterEqual(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeLess(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeLessEqual(long nativeQueryPtr, long columnIndex[], double value);
=======
>>>>>>>
<<<<<<<
private native void nativeBetween(long nativeQueryPtr, long columnIndex[], double value1, double value2);
=======
>>>>>>>
<<<<<<<
private native void nativeEqual(long nativeQueryPtr, long columnIndex[], boolean value);
=======
>>>>>>>
<<<<<<<
private native void nativeEqualDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeNotEqualDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreaterDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeGreaterEqualDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeLessDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeLessEqualDateTime(long nativeQueryPtr, long columnIndex[], long value);
=======
>>>>>>>
<<<<<<<
private native void nativeBetweenDateTime(long nativeQueryPtr, long columnIndex[], long value1, long value2);
=======
>>>>>>>
<<<<<<<
private native void nativeEqual(long nativeQueryPtr, long[] columnIndexes, String value, boolean caseSensitive);
=======
>>>>>>>
<<<<<<<
private native void nativeNotEqual(long nativeQueryPtr, long columnIndex[], String value, boolean caseSensitive);
=======
>>>>>>>
<<<<<<<
private native void nativeBeginsWith(long nativeQueryPtr, long columnIndices[], String value, boolean caseSensitive);
=======
>>>>>>>
<<<<<<<
private native void nativeEndsWith(long nativeQueryPtr, long columnIndices[], String value, boolean caseSensitive);
=======
>>>>>>>
<<<<<<<
private native void nativeContains(long nativeQueryPtr, long columnIndices[], String value, boolean caseSensitive);
=======
>>>>>>>
<<<<<<<
/**
* Perform a find query then handover the resulted Row (ready to be imported by another
* thread/shared_group).
* @param bgSharedGroupPtr current shared_group from which to operate the query
* @param nativeReplicationPtr replication pointer associated with the shared_group
* @param ptrQuery query to run the the find against
* @return pointer to the handover result (table_view)
*/
public long findWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0);
}
private native long nativeFind(long nativeQueryPtr, long fromTableRow);
=======
>>>>>>>
/**
* Perform a find query then handover the resulted Row (ready to be imported by another
* thread/shared_group).
* @param bgSharedGroupPtr current shared_group from which to operate the query
* @param nativeReplicationPtr replication pointer associated with the shared_group
* @param ptrQuery query to run the the find against
* @return pointer to the handover result (table_view)
*/
public long findWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0);
}
<<<<<<<
// handover find* methods
// this will use a background SharedGroup to import the query (using the handover object)
// run the query, and return the table view to the caller SharedGroup using the handover object.
public long findAllWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE);
}
public long findAllSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery, long columnIndex, boolean ascending) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllSortedWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndex, ascending);
}
public long findAllMultiSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery, long[] columnIndices, boolean[] ascending) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllMultiSortedWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndices, ascending);
}
// Suppose to be called from the caller SharedGroup thread
public TableView importHandoverTableView(long handoverPtr, long callerSharedGroupPtr) {
long nativeTvPtr = 0;
try {
nativeTvPtr = nativeImportHandoverTableViewIntoSharedGroup(handoverPtr, callerSharedGroupPtr);
return new TableView(this.context, this.table, nativeTvPtr);
} catch (RuntimeException e) {
if (nativeTvPtr != 0) {
TableView.nativeClose(nativeTvPtr);
}
throw e;
}
}
/**
* Handover the query, so it can be used by other SharedGroup (in different thread)
* @param callerSharedGroupPtr native pointer to the SharedGroup holding the query
* @return native pointer to the handover query
*/
public long handoverQuery(long callerSharedGroupPtr) {
return nativeHandoverQuery(callerSharedGroupPtr, nativePtr);
}
private native long nativeFindAll(long nativeQueryPtr, long start, long end, long limit);
public static native long nativeFindAllSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long nativeQueryPtr, long start, long end, long limit, long columnIndex, boolean ascending);
public static native long nativeFindAllWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long nativeQueryPtr, long start, long end, long limit);
public static native long nativeFindWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long nativeQueryPtr, long fromTableRow);
public static native long nativeFindAllMultiSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long nativeQueryPtr, long start, long end, long limit, long[] columnIndices, boolean[] ascending);
public static native long nativeImportHandoverRowIntoSharedGroup(long handoverRowPtr, long callerSharedGroupPtr);
public static native void nativeCloseQueryHandover (long nativePtr);
private native long nativeImportHandoverTableViewIntoSharedGroup(long handoverTableViewPtr, long callerSharedGroupPtr);
private native long nativeHandoverQuery(long callerSharedGroupPtr, long nativeQueryPtr);
=======
>>>>>>>
// handover find* methods
// this will use a background SharedGroup to import the query (using the handover object)
// run the query, and return the table view to the caller SharedGroup using the handover object.
public long findAllWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE);
}
public long findAllSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery, long columnIndex, boolean ascending) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllSortedWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndex, ascending);
}
public long findAllMultiSortedWithHandover(long bgSharedGroupPtr, long nativeReplicationPtr, long ptrQuery, long[] columnIndices, boolean[] ascending) {
validateQuery();
// Execute the disposal of abandoned realm objects each time a new realm object is created
context.executeDelayedDisposal();
return nativeFindAllMultiSortedWithHandover(bgSharedGroupPtr, nativeReplicationPtr, ptrQuery, 0, Table.INFINITE, Table.INFINITE, columnIndices, ascending);
}
// Suppose to be called from the caller SharedGroup thread
public TableView importHandoverTableView(long handoverPtr, long callerSharedGroupPtr) {
long nativeTvPtr = 0;
try {
nativeTvPtr = nativeImportHandoverTableViewIntoSharedGroup(handoverPtr, callerSharedGroupPtr);
return new TableView(this.context, this.table, nativeTvPtr);
} catch (RuntimeException e) {
if (nativeTvPtr != 0) {
TableView.nativeClose(nativeTvPtr);
}
throw e;
}
}
/**
* Handover the query, so it can be used by other SharedGroup (in different thread)
* @param callerSharedGroupPtr native pointer to the SharedGroup holding the query
* @return native pointer to the handover query
*/
public long handoverQuery(long callerSharedGroupPtr) {
return nativeHandoverQuery(callerSharedGroupPtr, nativePtr);
}
<<<<<<<
private native long nativeSumInt(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Long nativeMaximumInt(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Long nativeMinimumInt(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native double nativeAverageInt(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native double nativeSumFloat(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Float nativeMaximumFloat(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Float nativeMinimumFloat(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native double nativeAverageFloat(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native double nativeSumDouble(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Double nativeMaximumDouble(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Double nativeMinimumDouble(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native double nativeAverageDouble(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Long nativeMaximumDate(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native Long nativeMinimumDate(long nativeQueryPtr, long columnIndex, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native long nativeCount(long nativeQueryPtr, long start, long end, long limit);
=======
>>>>>>>
<<<<<<<
private native long nativeRemove(long nativeQueryPtr, long start, long end, long limit);
=======
>>>>>>> |
<<<<<<<
Class syncFacadeClass = Class.forName("io.realm.internal.objectserver.SyncObjectServerFacade");
//noinspection unchecked
syncFacade = (ObjectServerFacade) syncFacadeClass.getDeclaredConstructor().newInstance();
=======
Class syncFacadeClass = Class.forName("io.realm.internal.SyncObjectServerFacade");
syncFacade = (ObjectServerFacade) syncFacadeClass.newInstance();
>>>>>>>
Class syncFacadeClass = Class.forName("io.realm.internal.SyncObjectServerFacade");
//noinspection unchecked
syncFacade = (ObjectServerFacade) syncFacadeClass.getDeclaredConstructor().newInstance(); |
<<<<<<<
RealmConfiguration configuration = new RealmConfiguration
.Builder(context)
.schema(Owner.class, Cat.class)
.assetFile(context, "asset_file.realm")
=======
RealmConfiguration configuration = new RealmConfiguration.Builder(context).assetFile(context, "asset_file.realm")
.modules(new AssetFileModule())
>>>>>>>
RealmConfiguration configuration = new RealmConfiguration
.Builder(context)
.modules(new AssetFileModule())
.assetFile(context, "asset_file.realm") |
<<<<<<<
@Test
public void setAndGetNumbers() {
// Double column s
view.get(0).doubleNum.set(400d);
assertEquals(400d, view.get(0).doubleNum.get());
view.get(1).doubleNum.set(-0.01d);
assertEquals(-0.01d, view.get(1).doubleNum.get());
// FLoat columns
view.get(0).floatNum.set(400f);
assertEquals(400f, view.get(0).floatNum.get());
view.get(1).floatNum.set(-0.01f);
assertEquals(-0.01f, view.get(1).floatNum.get());
}
=======
>>>>>>>
@Test
public void setAndGetNumbers() {
// Double column s
view.get(0).doubleNum.set(400d);
assertEquals(400d, view.get(0).doubleNum.get());
view.get(1).doubleNum.set(-0.01d);
assertEquals(-0.01d, view.get(1).doubleNum.get());
// FLoat columns
view.get(0).floatNum.set(400f);
assertEquals(400f, view.get(0).floatNum.get());
view.get(1).floatNum.set(-0.01f);
assertEquals(-0.01f, view.get(1).floatNum.get());
} |
<<<<<<<
public void testHasPrimaryKey() {
Table table = testRealm.getTable(AnnotationTypes.class);
assertTrue(table.hasPrimaryKey());
}
// Test migrating primary key from string to long with existing data
public void testPrimaryKeyMigration_long() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsString obj = testRealm.createObject(PrimaryKeyAsString.class);
obj.setId(i);
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsString.class);
table.setPrimaryKey("id");
assertEquals(1, table.getPrimaryKey());
testRealm.cancelTransaction();
}
// Test migrating primary key from string to long with existing data
public void testPrimaryKeyMigration_longDuplicateValues() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsString obj = testRealm.createObject(PrimaryKeyAsString.class);
obj.setId(1); // Create duplicate values
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsString.class);
try {
table.setPrimaryKey("id");
} catch (RealmException e) {
assertEquals(0, table.getPrimaryKey());
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be possible to set a primary key column which already contains duplicate values.");
}
// Test migrating primary key from long to str with existing data
public void testPrimaryKeyMigration_string() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsLong obj = testRealm.createObject(PrimaryKeyAsLong.class);
obj.setId(i);
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsLong.class);
table.setPrimaryKey("name");
assertEquals(1, table.getPrimaryKey());
testRealm.cancelTransaction();
}
// Test migrating primary key from long to str with existing data
public void testPrimaryKeyMigration_stringDuplicateValues() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsLong obj = testRealm.createObject(PrimaryKeyAsLong.class);
obj.setId(i);
obj.setName("String"); // Create duplicate values
}
Table table = testRealm.getTable(PrimaryKeyAsLong.class);
try {
table.setPrimaryKey("name");
} catch (RealmException e) {
assertEquals(0, table.getPrimaryKey());
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be possible to set a primary key column which already contains duplicate values.");
}
public void testPrimaryKey_checkPrimaryKeyOnCreate() {
testRealm.beginTransaction();
testRealm.clear(AnnotationTypes.class);
testRealm.createObject(AnnotationTypes.class);
try {
testRealm.createObject(AnnotationTypes.class);
} catch (RealmException e) {
return;
} finally {
testRealm.cancelTransaction();
}
fail("Two empty objects cannot be created on the same table if a primary key is defined");
}
public void testPrimaryKey_defaultStringValue() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
try {
PrimaryKeyAsString str = testRealm.createObject(PrimaryKeyAsString.class);
str.setName("");
} catch (RealmException e) {
assertTrue(e.getMessage().endsWith("not allowed as value in a field that is a primary key."));
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be allowed to set a primary key to the default value for the field type");
}
public void testPrimaryKey_defaultLongValue() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
try {
PrimaryKeyAsLong str = testRealm.createObject(PrimaryKeyAsLong.class);
str.setId(0);
} catch (RealmException e) {
assertTrue(e.getMessage().endsWith("not allowed as value in a field that is a primary key."));
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be allowed to set a primary key to the default value for the field type");
}
public void testPrimaryKey_errorOnInsertingSameObject() {
try {
testRealm.beginTransaction();
testRealm.clear(AnnotationTypes.class);
AnnotationTypes obj1 = testRealm.createObject(AnnotationTypes.class);
obj1.setId(1);
AnnotationTypes obj2 = testRealm.createObject(AnnotationTypes.class);
obj2.setId(1);
} catch (RealmException e) {
return;
} finally {
testRealm.cancelTransaction();
}
fail("Inserting two objects with same primary key should fail");
}
public void testPrimaryKeyIsIndexed() {
Table table = testRealm.getTable(PrimaryKeyAsString.class);
assertTrue(table.hasPrimaryKey());
assertTrue(table.hasIndex(0));
}
=======
// Annotation processor honors common naming conventions
// We check if setters and getters are generated and working
public void testNamingConvention() {
Realm realm = Realm.getInstance(getContext());
realm.beginTransaction();
realm.clear(AnnotationNameConventions.class);
AnnotationNameConventions anc1 = realm.createObject(AnnotationNameConventions.class);
anc1.setHasObject(true);
anc1.setId_object(1);
anc1.setmObject(2);
anc1.setObject_id(3);
anc1.setObject(true);
realm.commitTransaction();
AnnotationNameConventions anc2 = realm.allObjects(AnnotationNameConventions.class).first();
assertTrue(anc2.isHasObject());
assertEquals(1, anc2.getId_object());
assertEquals(2, anc2.getmObject());
assertEquals(3, anc2.getObject_id());
assertTrue(anc2.isObject());
realm.close();
}
>>>>>>>
public void testHasPrimaryKey() {
Table table = testRealm.getTable(AnnotationTypes.class);
assertTrue(table.hasPrimaryKey());
}
// Test migrating primary key from string to long with existing data
public void testPrimaryKeyMigration_long() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsString obj = testRealm.createObject(PrimaryKeyAsString.class);
obj.setId(i);
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsString.class);
table.setPrimaryKey("id");
assertEquals(1, table.getPrimaryKey());
testRealm.cancelTransaction();
}
// Test migrating primary key from string to long with existing data
public void testPrimaryKeyMigration_longDuplicateValues() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsString obj = testRealm.createObject(PrimaryKeyAsString.class);
obj.setId(1); // Create duplicate values
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsString.class);
try {
table.setPrimaryKey("id");
} catch (RealmException e) {
assertEquals(0, table.getPrimaryKey());
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be possible to set a primary key column which already contains duplicate values.");
}
// Test migrating primary key from long to str with existing data
public void testPrimaryKeyMigration_string() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsLong obj = testRealm.createObject(PrimaryKeyAsLong.class);
obj.setId(i);
obj.setName("String" + i);
}
Table table = testRealm.getTable(PrimaryKeyAsLong.class);
table.setPrimaryKey("name");
assertEquals(1, table.getPrimaryKey());
testRealm.cancelTransaction();
}
// Test migrating primary key from long to str with existing data
public void testPrimaryKeyMigration_stringDuplicateValues() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
for (int i = 1; i <= 2; i++) {
PrimaryKeyAsLong obj = testRealm.createObject(PrimaryKeyAsLong.class);
obj.setId(i);
obj.setName("String"); // Create duplicate values
}
Table table = testRealm.getTable(PrimaryKeyAsLong.class);
try {
table.setPrimaryKey("name");
} catch (RealmException e) {
assertEquals(0, table.getPrimaryKey());
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be possible to set a primary key column which already contains duplicate values.");
}
public void testPrimaryKey_checkPrimaryKeyOnCreate() {
testRealm.beginTransaction();
testRealm.clear(AnnotationTypes.class);
testRealm.createObject(AnnotationTypes.class);
try {
testRealm.createObject(AnnotationTypes.class);
} catch (RealmException e) {
return;
} finally {
testRealm.cancelTransaction();
}
fail("Two empty objects cannot be created on the same table if a primary key is defined");
}
public void testPrimaryKey_defaultStringValue() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsString.class);
try {
PrimaryKeyAsString str = testRealm.createObject(PrimaryKeyAsString.class);
str.setName("");
} catch (RealmException e) {
assertTrue(e.getMessage().endsWith("not allowed as value in a field that is a primary key."));
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be allowed to set a primary key to the default value for the field type");
}
public void testPrimaryKey_defaultLongValue() {
testRealm.beginTransaction();
testRealm.clear(PrimaryKeyAsLong.class);
try {
PrimaryKeyAsLong str = testRealm.createObject(PrimaryKeyAsLong.class);
str.setId(0);
} catch (RealmException e) {
assertTrue(e.getMessage().endsWith("not allowed as value in a field that is a primary key."));
return;
} finally {
testRealm.cancelTransaction();
}
fail("It should not be allowed to set a primary key to the default value for the field type");
}
public void testPrimaryKey_errorOnInsertingSameObject() {
try {
testRealm.beginTransaction();
testRealm.clear(AnnotationTypes.class);
AnnotationTypes obj1 = testRealm.createObject(AnnotationTypes.class);
obj1.setId(1);
AnnotationTypes obj2 = testRealm.createObject(AnnotationTypes.class);
obj2.setId(1);
} catch (RealmException e) {
return;
} finally {
testRealm.cancelTransaction();
}
fail("Inserting two objects with same primary key should fail");
}
public void testPrimaryKeyIsIndexed() {
Table table = testRealm.getTable(PrimaryKeyAsString.class);
assertTrue(table.hasPrimaryKey());
assertTrue(table.hasIndex(0));
}
// Annotation processor honors common naming conventions
// We check if setters and getters are generated and working
public void testNamingConvention() {
Realm realm = Realm.getInstance(getContext());
realm.beginTransaction();
realm.clear(AnnotationNameConventions.class);
AnnotationNameConventions anc1 = realm.createObject(AnnotationNameConventions.class);
anc1.setHasObject(true);
anc1.setId_object(1);
anc1.setmObject(2);
anc1.setObject_id(3);
anc1.setObject(true);
realm.commitTransaction();
AnnotationNameConventions anc2 = realm.allObjects(AnnotationNameConventions.class).first();
assertTrue(anc2.isHasObject());
assertEquals(1, anc2.getId_object());
assertEquals(2, anc2.getmObject());
assertEquals(3, anc2.getObject_id());
assertTrue(anc2.isObject());
realm.close();
} |
<<<<<<<
public static RealmConfiguration createConfiguration(File dir, String name, byte[] key) {
RealmConfiguration.Builder config = new RealmConfiguration.Builder(InstrumentationRegistry.getInstrumentation().getTargetContext())
=======
public static RealmConfiguration createConfiguration(File dir, String name, @Nullable byte[] key) {
RealmConfiguration.Builder config = new RealmConfiguration.Builder(InstrumentationRegistry.getTargetContext())
>>>>>>>
public static RealmConfiguration createConfiguration(File dir, String name, @Nullable byte[] key) {
RealmConfiguration.Builder config = new RealmConfiguration.Builder(InstrumentationRegistry.getInstrumentation().getTargetContext())
<<<<<<<
// Workaround to cheat Kotlins type system when testing interop with Java
@SuppressWarnings("TypeParameterUnusedInFormals")
public static <T> T getNull() {
return null;
}
// Workaround to cheat Kotlins type system when testing interop with Java
@Nonnull
public static <T> T allowNull(@Nullable T value) {
return value;
}
public static String randomObjectIdHexString() {
char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E' , 'F'};
StringBuilder randomId = new StringBuilder(24);
for (int i = 0; i < 24; i++) {
randomId.append(hex[RANDOM.nextInt(16)]);
}
return randomId.toString();
}
public static String generateObjectIdHexString(int i) {
char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E' , 'F'};
StringBuilder randomId = new StringBuilder(24);
for (int j = 0; j < 24; j++) {
randomId.append(hex[(i + j) % 16]);
}
return randomId.toString();
}
=======
// Workaround to cheat Kotlins type system when testing interop with Java
@SuppressWarnings("TypeParameterUnusedInFormals")
public static <T> T getNull() {
return null;
}
>>>>>>>
// Workaround to cheat Kotlins type system when testing interop with Java
@SuppressWarnings("TypeParameterUnusedInFormals")
public static <T> T getNull() {
return null;
}
// Workaround to cheat Kotlins type system when testing interop with Java
@Nonnull
public static <T> T allowNull(@Nullable T value) {
return value;
}
public static String randomObjectIdHexString() {
char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E' , 'F'};
StringBuilder randomId = new StringBuilder(24);
for (int i = 0; i < 24; i++) {
randomId.append(hex[RANDOM.nextInt(16)]);
}
return randomId.toString();
}
public static String generateObjectIdHexString(int i) {
char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E' , 'F'};
StringBuilder randomId = new StringBuilder(24);
for (int j = 0; j < 24; j++) {
randomId.append(hex[(i + j) % 16]);
}
return randomId.toString();
} |
<<<<<<<
if (!syncAvailable) {
if (commitNeeded) {
realm.commitTransaction();
} else {
realm.cancelTransaction();
}
=======
if (commitChanges) {
realm.commitTransaction(false);
} else {
realm.cancelTransaction();
>>>>>>>
if (commitChanges) {
realm.commitTransaction();
} else {
realm.cancelTransaction();
<<<<<<<
// Avoid to call canDeliverNotification() in bg thread.
final boolean canDeliverNotification = sharedRealm.capabilities.canDeliverNotification();
// If the user provided a Callback then we have to make sure the current Realm has an events looper to deliver
// the results.
if ((onSuccess != null || onError != null) && !canDeliverNotification) {
throw new IllegalStateException("Your Realm is opened from a thread without a event looper." +
" The callback cannot be invoked.");
=======
// If the user provided a Callback then we make sure, the current Realm has a Handler
// we can use to deliver the result
if ((onSuccess != null || onError != null) && !hasValidNotifier()) {
throw new IllegalStateException("Your Realm is opened from a thread without a Looper" +
" and you provided a callback, we need a Handler to invoke your callback");
>>>>>>>
// Avoid to call canDeliverNotification() in bg thread.
final boolean canDeliverNotification = sharedRealm.capabilities.canDeliverNotification();
// If the user provided a Callback then we have to make sure the current Realm has an events looper to deliver
// the results.
if ((onSuccess != null || onError != null) && !canDeliverNotification) {
throw new IllegalStateException("Your Realm is opened from a thread without an event looper." +
" The callback cannot be invoked."); |
<<<<<<<
=======
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
>>>>>>>
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.stream.Collectors; |
<<<<<<<
void checkLegalName(String fieldName) {
//noinspection ConstantConditions
=======
static void checkLegalName(String fieldName) {
>>>>>>>
static void checkLegalName(String fieldName) {
//noinspection ConstantConditions |
<<<<<<<
public void removeColumn(long columnIndex) {
=======
@Override
public void removeColumn(long columnIndex) {
>>>>>>>
@Override
public void removeColumn(long columnIndex) {
<<<<<<<
/*
=======
@Override
>>>>>>>
/*
@Override
<<<<<<<
/*
=======
@Override
>>>>>>>
/*
@Override
<<<<<<<
public void adjust(long columnIndex, long value) {
=======
@Override
public void addLong(long columnIndex, long value) {
>>>>>>>
@Override
public void adjust(long columnIndex, long value) {
<<<<<<<
public long sumInt(long columnIndex) {
return nativeSumInt(nativePtr, columnIndex);
=======
@Override
public long sum(long columnIndex) {
return nativeSum(nativePtr, columnIndex);
>>>>>>>
@Override
public long sumInt(long columnIndex) {
return nativeSumInt(nativePtr, columnIndex);
<<<<<<<
public long maximumInt(long columnIndex) {
return nativeMaximumInt(nativePtr, columnIndex);
=======
@Override
public long maximum(long columnIndex) {
return nativeMaximum(nativePtr, columnIndex);
>>>>>>>
@Override
public long maximumInt(long columnIndex) {
return nativeMaximumInt(nativePtr, columnIndex);
<<<<<<<
public long minimumInt(long columnIndex) {
return nativeMinimumInt(nativePtr, columnIndex);
=======
@Override
public long minimum(long columnIndex) {
return nativeMinimum(nativePtr, columnIndex);
>>>>>>>
@Override
public long minimumInt(long columnIndex) {
return nativeMinimumInt(nativePtr, columnIndex);
<<<<<<<
public double averageInt(long columnIndex) {
return nativeAverageInt(nativePtr, columnIndex);
=======
@Override
public double average(long columnIndex) {
return nativeAverage(nativePtr, columnIndex);
>>>>>>>
@Override
public double averageInt(long columnIndex) {
return nativeAverageInt(nativePtr, columnIndex);
<<<<<<<
/* // Requires that the first column is a string column with unique values. Also index required?
@Override
=======
// Requires that the first column is a string column with index
@Override
>>>>>>>
/* // Requires that the first column is a string column with unique values. Also index required?
@Override
<<<<<<<
public TableView getDistinctView(long columnIndex) {
return new TableView(nativeGetDistinctView(nativePtr, columnIndex), immutable);
=======
public TableView distinct(long columnIndex) {
return new TableView(nativeDistinct(nativePtr, columnIndex), immutable);
>>>>>>>
public TableView getDistinctView(long columnIndex) {
return new TableView(nativeGetDistinctView(nativePtr, columnIndex), immutable);
<<<<<<<
=======
@Override
>>>>>>>
@Override |
<<<<<<<
=======
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
>>>>>>>
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
<<<<<<<
private Elements elementUtils;
private Types typeUtils;
private TypeMirror realmObject;
private DeclaredType realmList;
public RealmProxyClassGenerator(ProcessingEnvironment processingEnvironment, String className, String packageName, List<VariableElement> fields, List<VariableElement> fieldsToIndex) {
=======
private Types typeUtils;
private TypeMirror realmObject;
private DeclaredType realmList;
public RealmProxyClassGenerator(ProcessingEnvironment processingEnvironment,
String className, String packageName,
List<VariableElement> fields,
Map<String, String> getters, Map<String, String> setters,
List<VariableElement> fieldsToIndex) {
>>>>>>>
private Elements elementUtils;
private Types typeUtils;
private TypeMirror realmObject;
private DeclaredType realmList;
public RealmProxyClassGenerator(ProcessingEnvironment processingEnvironment,
String className, String packageName,
List<VariableElement> fields,
Map<String, String> getters, Map<String, String> setters,
List<VariableElement> fieldsToIndex) {
<<<<<<<
elementUtils = processingEnvironment.getElementUtils();
typeUtils = processingEnvironment.getTypeUtils();
=======
Elements elementUtils = processingEnvironment.getElementUtils();
typeUtils = processingEnvironment.getTypeUtils();
>>>>>>>
elementUtils = processingEnvironment.getElementUtils();
typeUtils = processingEnvironment.getTypeUtils();
<<<<<<<
"org.json.JSONObject",
"org.json.JSONException",
"org.json.JSONArray",
"android.util.JsonReader",
"android.util.JsonToken",
"java.io.IOException",
=======
"io.realm.Realm",
>>>>>>>
"io.realm.Realm",
"org.json.JSONObject",
"org.json.JSONException",
"org.json.JSONArray",
"android.util.JsonReader",
"android.util.JsonToken",
"java.io.IOException",
<<<<<<<
// Add JSON methods
emitPopulateUsingJsonObjectMethod(writer);
emitPopulateUsingJsonStreamMethod(writer);
// End the class definition
writer.endType();
writer.close();
}
private void emitPopulateUsingJsonObjectMethod(JavaWriter writer) throws IOException {
writer.emitAnnotation(Override.class);
writer.beginMethod(
"void",
"populateUsingJsonObject",
EnumSet.of(Modifier.PROTECTED),
Arrays.asList("JSONObject", "json"),
Arrays.asList("JSONException"));
for (VariableElement field : fields) {
String fieldName = field.getSimpleName().toString();
String fieldTypeCanonicalName = field.asType().toString();
if (typeUtils.isAssignable(field.asType(), realmObject)) {
RealmJsonTypeHelper.emitFillRealmObjectWithJsonValue(
fieldName,
fieldTypeCanonicalName,
writer);
} else if (typeUtils.isAssignable(field.asType(), realmList)) {
RealmJsonTypeHelper.emitFillRealmListWithJsonValue(
fieldName,
((DeclaredType) field.asType()).getTypeArguments().get(0).toString(),
writer);
} else {
RealmJsonTypeHelper.emitFillJavaTypeWithJsonValue(
fieldName,
fieldTypeCanonicalName,
writer);
}
}
writer.endMethod();
writer.emitEmptyLine();
}
private void emitPopulateUsingJsonStreamMethod(JavaWriter writer) throws IOException {
writer.emitAnnotation(Override.class);
writer.beginMethod(
"void",
"populateUsingJsonStream",
EnumSet.of(Modifier.PROTECTED),
Arrays.asList("JsonReader", "reader"),
Arrays.asList("IOException"));
writer.emitStatement("reader.beginObject()");
writer.beginControlFlow("while (reader.hasNext())");
writer.emitStatement("String name = reader.nextName()");
for (int i = 0; i < fields.size(); i++) {
VariableElement field = fields.get(i);
String fieldName = field.getSimpleName().toString();
String fieldTypeCanonicalName = field.asType().toString();
if (i == 0) {
writer.beginControlFlow("if (name.equals(\"%s\") && reader.peek() != JsonToken.NULL)", fieldName);
} else {
writer.nextControlFlow("else if (name.equals(\"%s\") && reader.peek() != JsonToken.NULL)", fieldName);
}
if (typeUtils.isAssignable(field.asType(), realmObject)) {
RealmJsonTypeHelper.emitFillRealmObjectFromStream(
fieldName,
fieldTypeCanonicalName,
writer);
} else if (typeUtils.isAssignable(field.asType(), realmList)) {
RealmJsonTypeHelper.emitFillRealmListFromStream(
fieldName,
((DeclaredType) field.asType()).getTypeArguments().get(0).toString(),
writer);
} else {
RealmJsonTypeHelper.emitFillJavaTypeFromStream(
fieldName,
fieldTypeCanonicalName,
writer);
}
}
writer.nextControlFlow("else");
writer.emitStatement("reader.skipValue()");
writer.endControlFlow();
writer.endControlFlow();
writer.emitStatement("reader.endObject()");
writer.endMethod();
writer.emitEmptyLine();
}
private static String capitaliseFirstChar(String input) {
return input.substring(0, 1).toUpperCase() + input.substring(1);
=======
>>>>>>>
}
private void emitPopulateUsingJsonObjectMethod(JavaWriter writer) throws IOException {
writer.emitAnnotation(Override.class);
writer.beginMethod(
"void",
"populateUsingJsonObject",
EnumSet.of(Modifier.PROTECTED),
Arrays.asList("JSONObject", "json"),
Arrays.asList("JSONException"));
for (VariableElement field : fields) {
String fieldName = field.getSimpleName().toString();
String fieldTypeCanonicalName = field.asType().toString();
if (typeUtils.isAssignable(field.asType(), realmObject)) {
RealmJsonTypeHelper.emitFillRealmObjectWithJsonValue(
fieldName,
fieldTypeCanonicalName,
writer);
} else if (typeUtils.isAssignable(field.asType(), realmList)) {
RealmJsonTypeHelper.emitFillRealmListWithJsonValue(
fieldName,
((DeclaredType) field.asType()).getTypeArguments().get(0).toString(),
writer);
} else {
RealmJsonTypeHelper.emitFillJavaTypeWithJsonValue(
fieldName,
fieldTypeCanonicalName,
writer);
}
}
writer.endMethod();
writer.emitEmptyLine();
}
private void emitPopulateUsingJsonStreamMethod(JavaWriter writer) throws IOException {
writer.emitAnnotation(Override.class);
writer.beginMethod(
"void",
"populateUsingJsonStream",
EnumSet.of(Modifier.PROTECTED),
Arrays.asList("JsonReader", "reader"),
Arrays.asList("IOException"));
writer.emitStatement("reader.beginObject()");
writer.beginControlFlow("while (reader.hasNext())");
writer.emitStatement("String name = reader.nextName()");
for (int i = 0; i < fields.size(); i++) {
VariableElement field = fields.get(i);
String fieldName = field.getSimpleName().toString();
String fieldTypeCanonicalName = field.asType().toString();
if (i == 0) {
writer.beginControlFlow("if (name.equals(\"%s\") && reader.peek() != JsonToken.NULL)", fieldName);
} else {
writer.nextControlFlow("else if (name.equals(\"%s\") && reader.peek() != JsonToken.NULL)", fieldName);
}
if (typeUtils.isAssignable(field.asType(), realmObject)) {
RealmJsonTypeHelper.emitFillRealmObjectFromStream(
fieldName,
fieldTypeCanonicalName,
writer);
} else if (typeUtils.isAssignable(field.asType(), realmList)) {
RealmJsonTypeHelper.emitFillRealmListFromStream(
fieldName,
((DeclaredType) field.asType()).getTypeArguments().get(0).toString(),
writer);
} else {
RealmJsonTypeHelper.emitFillJavaTypeFromStream(
fieldName,
fieldTypeCanonicalName,
writer);
}
}
writer.nextControlFlow("else");
writer.emitStatement("reader.skipValue()");
writer.endControlFlow();
writer.endControlFlow();
writer.emitStatement("reader.endObject()");
writer.endMethod();
writer.emitEmptyLine();
// End the class definition
writer.endType();
writer.close();
} |
<<<<<<<
table.addAt(0, false);
assertTrue(false);
=======
table.insert(0, false);
fail("expected exception.");
>>>>>>>
table.addAt(0, false);
fail("expected exception.");
<<<<<<<
table.addAt(1, false, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(1, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(1, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(3, false, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(3, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(3, false, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(0, 999, 1, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, 999, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(0, 999, 1, "hi", buf, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(0, true, false, "hi", buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, true, false, "hi", buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(0, true, false, "hi", buf, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(0, false, 1, 999, buf, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, 999, buf, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(0, false, 1, 999, buf, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(0, false, 1, "hi", 999, new Date(), mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, "hi", 999, new Date(), mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(0, false, 1, "hi", 999, new Date(), mix, null);
fail("expected exception.");
<<<<<<<
table.addAt(0, false, 1, "hi", buf, 999, mix, null);
assertTrue(false);
=======
table.insert(0, false, 1, "hi", buf, 999, mix, null);
fail("expected exception.");
>>>>>>>
table.addAt(0, false, 1, "hi", buf, 999, mix, null);
fail("expected exception."); |
<<<<<<<
public TableQuery equalTo(long columnIndex, Date value){
nativeEqualDate(nativePtr, columnIndex, value.getTime()/1000);
=======
public TableQuery equal(long columnIndex, Date value){
nativeEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
public TableQuery eq(long columnIndex, Date value){
nativeEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
>>>>>>>
public TableQuery equalTo(long columnIndex, Date value){
nativeEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
<<<<<<<
public TableQuery notEqualTo(long columnIndex, Date value){
nativeNotEqualDate(nativePtr, columnIndex, value.getTime()/1000);
=======
public TableQuery notEqual(long columnIndex, Date value){
nativeNotEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
public TableQuery neq(long columnIndex, Date value){
nativeNotEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
>>>>>>>
public TableQuery notEqualTo(long columnIndex, Date value){
nativeNotEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
<<<<<<<
protected native void nativeGreaterDate(long nativeQueryPtr, long columnIndex, long value);
=======
public TableQuery gt(long columnIndex, Date value){
nativeGreaterDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
protected native void nativeGreaterDateTime(long nativeQueryPtr, long columnIndex, long value);
>>>>>>>
protected native void nativeGreaterDateTime(long nativeQueryPtr, long columnIndex, long value);
<<<<<<<
protected native void nativeGreaterEqualDate(long nativeQueryPtr, long columnIndex, long value);
=======
public TableQuery gte(long columnIndex, Date value){
nativeGreaterEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
protected native void nativeGreaterEqualDateTime(long nativeQueryPtr, long columnIndex, long value);
>>>>>>>
protected native void nativeGreaterEqualDateTime(long nativeQueryPtr, long columnIndex, long value);
<<<<<<<
protected native void nativeLessDate(long nativeQueryPtr, long columnIndex, long value);
=======
public TableQuery lt(long columnIndex, Date value){
nativeLessDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
protected native void nativeLessDateTime(long nativeQueryPtr, long columnIndex, long value);
>>>>>>>
protected native void nativeLessDateTime(long nativeQueryPtr, long columnIndex, long value);
<<<<<<<
protected native void nativeLessEqualDate(long nativeQueryPtr, long columnIndex, long value);
=======
public TableQuery lte(long columnIndex, Date value){
nativeLessEqualDateTime(nativePtr, columnIndex, value.getTime()/1000);
return this;
}
protected native void nativeLessEqualDateTime(long nativeQueryPtr, long columnIndex, long value);
>>>>>>>
protected native void nativeLessEqualDateTime(long nativeQueryPtr, long columnIndex, long value); |
<<<<<<<
import io.realm.entities.Dog;
import io.realm.entities.FieldOrder;
=======
import io.realm.entities.AnnotationTypes;
>>>>>>>
import io.realm.entities.FieldOrder;
import io.realm.entities.AnnotationTypes;
<<<<<<<
@Override
protected void tearDown() throws Exception {
super.tearDown();
Realm.setSchema(null);
}
=======
public Realm realm;
@Override
protected void setUp() throws Exception {
super.setUp();
Realm.deleteRealmFile(getContext());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (realm != null) {
realm.close();
}
Realm.setSchema(null);
}
>>>>>>>
public Realm realm;
@Override
protected void setUp() throws Exception {
super.setUp();
Realm.deleteRealmFile(getContext());
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (realm != null) {
realm.close();
}
Realm.setSchema(null);
}
<<<<<<<
// If a migration creates a different ordering of columns on Realm A, while another ordering is generated by
// creating a new Realm B. Global column indices will not work. They must be calculated for each Realm.
public void testLocalColumnIndices() throws IOException {
String MIGRATED_REALM = "migrated.realm";
String NEW_REALM = "new.realm";
// Migrate old Realm to proper schema
Realm.deleteRealmFile(getContext(), MIGRATED_REALM);
Realm.setSchema(AllTypes.class);
Realm migratedRealm = Realm.getInstance(getContext(), MIGRATED_REALM);
migratedRealm.close();
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), MIGRATED_REALM).getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table languageTable = realm.getTable(FieldOrder.class);
if (languageTable.getColumnCount() == 0) {
languageTable.addColumn(ColumnType.INTEGER, "field2");
languageTable.addColumn(ColumnType.BOOLEAN, "field1");
}
return version + 1;
}
});
// Open migrated Realm and populate column indices based on migration ordering.
Realm.setSchema(AllTypes.class, FieldOrder.class);
migratedRealm = Realm.getInstance(getContext(), MIGRATED_REALM);
// Create new Realm which will cause column indices to be recalculated based on the order in the java file
// instead of the migration
Realm.deleteRealmFile(getContext(), NEW_REALM);
Realm newRealm = Realm.getInstance(getContext(), NEW_REALM);
newRealm.close();
// Try to query migrated realm. With local column indices this will work. With global it will fail.
assertEquals(0, migratedRealm.where(FieldOrder.class).equalTo("field1", true).findAll().size());
}
=======
public void testNotSettingIndexThrows() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
table.setPrimaryKey("id");
table.addColumn(ColumnType.STRING, "indexString");
table.addColumn(ColumnType.STRING, "notIndexString");
// Forget to set @Index
return 1;
}
});
try {
realm = Realm.getInstance(getContext());
fail();
} catch (RealmMigrationNeededException expected) {
}
}
public void testNotSettingPrimaryKeyThrows() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
// Forget to set @PrimaryKey
long columnIndex = table.addColumn(ColumnType.STRING, "indexString");
table.setIndex(columnIndex);
table.addColumn(ColumnType.STRING, "notIndexString");
return 1;
}
});
try {
realm = Realm.getInstance(getContext());
fail();
} catch (RealmMigrationNeededException expected) {
}
}
public void testSetAnnotations() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
table.setPrimaryKey("id");
long columnIndex = table.addColumn(ColumnType.STRING, "indexString");
table.setIndex(columnIndex);
table.addColumn(ColumnType.STRING, "notIndexString");
return 1;
}
});
realm = Realm.getInstance(getContext());
Table table = realm.getTable(AnnotationTypes.class);
assertEquals(3, table.getColumnCount());
assertTrue(table.hasPrimaryKey());
assertTrue(table.hasIndex(table.getColumnIndex("indexString")));
}
>>>>>>>
// If a migration creates a different ordering of columns on Realm A, while another ordering is generated by
// creating a new Realm B. Global column indices will not work. They must be calculated for each Realm.
public void testLocalColumnIndices() throws IOException {
String MIGRATED_REALM = "migrated.realm";
String NEW_REALM = "new.realm";
// Migrate old Realm to proper schema
Realm.deleteRealmFile(getContext(), MIGRATED_REALM);
Realm.setSchema(AllTypes.class);
Realm migratedRealm = Realm.getInstance(getContext(), MIGRATED_REALM);
migratedRealm.close();
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), MIGRATED_REALM).getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table languageTable = realm.getTable(FieldOrder.class);
if (languageTable.getColumnCount() == 0) {
languageTable.addColumn(ColumnType.INTEGER, "field2");
languageTable.addColumn(ColumnType.BOOLEAN, "field1");
}
return version + 1;
}
});
// Open migrated Realm and populate column indices based on migration ordering.
Realm.setSchema(AllTypes.class, FieldOrder.class);
migratedRealm = Realm.getInstance(getContext(), MIGRATED_REALM);
// Create new Realm which will cause column indices to be recalculated based on the order in the java file
// instead of the migration
Realm.deleteRealmFile(getContext(), NEW_REALM);
Realm newRealm = Realm.getInstance(getContext(), NEW_REALM);
newRealm.close();
// Try to query migrated realm. With local column indices this will work. With global it will fail.
assertEquals(0, migratedRealm.where(FieldOrder.class).equalTo("field1", true).findAll().size());
}
public void testNotSettingIndexThrows() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
table.setPrimaryKey("id");
table.addColumn(ColumnType.STRING, "indexString");
table.addColumn(ColumnType.STRING, "notIndexString");
// Forget to set @Index
return 1;
}
});
try {
realm = Realm.getInstance(getContext());
fail();
} catch (RealmMigrationNeededException expected) {
}
}
public void testNotSettingPrimaryKeyThrows() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
// Forget to set @PrimaryKey
long columnIndex = table.addColumn(ColumnType.STRING, "indexString");
table.setIndex(columnIndex);
table.addColumn(ColumnType.STRING, "notIndexString");
return 1;
}
});
try {
realm = Realm.getInstance(getContext());
fail();
} catch (RealmMigrationNeededException expected) {
}
}
public void testSetAnnotations() {
Realm.setSchema(AnnotationTypes.class);
Realm.migrateRealmAtPath(new File(getContext().getFilesDir(), "default.realm").getAbsolutePath(), new RealmMigration() {
@Override
public long execute(Realm realm, long version) {
Table table = realm.getTable(AnnotationTypes.class);
table.addColumn(ColumnType.INTEGER, "id");
table.setPrimaryKey("id");
long columnIndex = table.addColumn(ColumnType.STRING, "indexString");
table.setIndex(columnIndex);
table.addColumn(ColumnType.STRING, "notIndexString");
return 1;
}
});
realm = Realm.getInstance(getContext());
Table table = realm.getTable(AnnotationTypes.class);
assertEquals(3, table.getColumnCount());
assertTrue(table.hasPrimaryKey());
assertTrue(table.hasIndex(table.getColumnIndex("indexString")));
} |
<<<<<<<
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
=======
import android.util.Log;
>>>>>>>
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
<<<<<<<
=======
private static final Map<String, ThreadRealm> realms = new HashMap<String, ThreadRealm>();
private static final String TAG = "REALM";
private static final String TABLE_PREFIX = "class_";
>>>>>>>
private static final Map<String, ThreadRealm> realms = new HashMap<String, ThreadRealm>();
private static final String TAG = "REALM";
private static final String TABLE_PREFIX = "class_"; |
<<<<<<<
import android.content.Context;
import android.os.Looper;
=======
>>>>>>>
import android.os.Looper; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.