Skip to content

Commit

Permalink
HSEARCH-4721 Re-enable tests disabled because of HHH-15606/HHH-15967
Browse files Browse the repository at this point in the history
This reverts commit 4be0604.
  • Loading branch information
yrodiere committed Jul 3, 2023
1 parent 2c4aef0 commit 557843c
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ public AbstractAutomaticIndexingAssociationBaseIT(IndexedEntityPrimitives<TIndex

protected abstract boolean isAssociationLazyOnContainingSide();

protected boolean includeEmbeddedAssociationsInSchema() {
return true;
}

protected boolean isEmbeddedAssociationChangeCausingWork() {
return !isAssociationOwnedByContainedSide() && !isAssociationMultiValuedOnContainingSide();
}
Expand Down Expand Up @@ -296,17 +292,15 @@ public void setup(OrmSetupHelper.SetupContext setupContext, ReusableOrmSetupHold
.field( "indexedField", String.class )
)
)
.with( includeEmbeddedAssociationsInSchema() ? bWith -> bWith
.objectField( "embeddedAssociations", b2 -> b2
.objectField( "containedIndexedEmbedded",
associationFieldContributor.andThen( b3 -> b3
.field( "indexedField", String.class )
.field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) )
.field( "containedDerivedField", String.class )
)
.objectField( "embeddedAssociations", b2 -> b2
.objectField( "containedIndexedEmbedded",
associationFieldContributor.andThen( b3 -> b3
.field( "indexedField", String.class )
.field( "indexedElementCollectionField", String.class, b4 -> b4.multiValued( true ) )
.field( "containedDerivedField", String.class )
)
)
: bWith -> { } )
)
.with( isElementCollectionAssociationsOnContainingSide()
? bWith -> bWith
.objectField( "elementCollectionAssociations", b2 -> b2
Expand Down Expand Up @@ -360,18 +354,16 @@ public void setup(OrmSetupHelper.SetupContext setupContext, ReusableOrmSetupHold
.field( "indexedField", String.class )
)
)
.with( includeEmbeddedAssociationsInSchema() ? bWith -> bWith
.objectField( "embeddedAssociations", b2 -> b2
.objectField( "containedIndexedEmbedded",
associationFieldContributor.andThen( b3 -> b3
.field( "indexedField", String.class )
.field( "indexedElementCollectionField", String.class,
.objectField( "embeddedAssociations", b2 -> b2
.objectField( "containedIndexedEmbedded",
associationFieldContributor.andThen( b3 -> b3
.field( "indexedField", String.class )
.field( "indexedElementCollectionField", String.class,
b4 -> b4.multiValued( true ) )
.field( "containedDerivedField", String.class )
)
.field( "containedDerivedField", String.class )
)
)
: bWith -> { } )
)
.with( isElementCollectionAssociationsOnContainingSide()
? bWith -> bWith
.objectField( "elementCollectionAssociations", b2 -> b2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.onetoone.ownedbycontained;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;

import java.lang.reflect.Method;
import java.util.ArrayList;
Expand Down Expand Up @@ -89,57 +88,6 @@ protected boolean isAssociationLazyOnContainingSide() {
return true;
}

@Override
protected boolean includeEmbeddedAssociationsInSchema() {
// See https://hibernate.atlassian.net/browse/HHH-15606
return false;
}

@Override
public void directAssociationUpdate_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectAssociationUpdate_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

private void notTestedBecauseOfHHH15606() {
assumeTrue( "This test is disabled because of https://hibernate.atlassian.net/browse/HHH-15606",
false );
}

@Override
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
Expand Down Expand Up @@ -190,6 +138,9 @@ public static class ContainingEntity {
"containedIndexedEmbeddedNoReindexOnUpdate.indexedElementCollectionField",
"containedIndexedEmbeddedNoReindexOnUpdate.containedDerivedField",
"containedIndexedEmbeddedWithCast.indexedField",
"embeddedAssociations.containedIndexedEmbedded.indexedField",
"embeddedAssociations.containedIndexedEmbedded.indexedElementCollectionField",
"embeddedAssociations.containedIndexedEmbedded.containedDerivedField",
"containedElementCollectionAssociationsIndexedEmbedded.indexedField",
"containedElementCollectionAssociationsIndexedEmbedded.indexedElementCollectionField",
"containedElementCollectionAssociationsIndexedEmbedded.containedDerivedField",
Expand Down Expand Up @@ -228,6 +179,10 @@ public static class ContainingEntity {
@IndexedEmbedded(includePaths = { "indexedField" }, targetType = ContainedEntity.class)
private Object containedIndexedEmbeddedWithCast;

@IndexedEmbedded
@Embedded
private ContainingEmbeddable embeddedAssociations;

/*
* No mappedBy here. The inverse side of associations within an element collection cannot use mappedBy.
* If they do, Hibernate ORM will fail (throw an exception) while attempting to walk down the mappedBy path,
Expand Down Expand Up @@ -341,6 +296,14 @@ public void setContainedIndexedEmbeddedWithCast(Object containedIndexedEmbeddedW
this.containedIndexedEmbeddedWithCast = containedIndexedEmbeddedWithCast;
}

public ContainingEmbeddable getEmbeddedAssociations() {
return embeddedAssociations;
}

public void setEmbeddedAssociations(ContainingEmbeddable embeddedAssociations) {
this.embeddedAssociations = embeddedAssociations;
}

public ContainedEntity getContainedElementCollectionAssociationsIndexedEmbedded() {
return containedElementCollectionAssociationsIndexedEmbedded;
}
Expand Down Expand Up @@ -444,9 +407,9 @@ public PropertyAccessor<ContainingEntity, ContainedEntity> containedIndexedEmbed

@Override
public PropertyAccessor<ContainingEntity, ContainingEmbeddable> embeddedAssociations() {
// See https://hibernate.atlassian.net/browse/HHH-15606
throw primitiveNotSupported();
}
return PropertyAccessor.create( ContainingEntity::setEmbeddedAssociations,
ContainingEntity::getEmbeddedAssociations );
}

@Override
public PropertyAccessor<ContainingEntity,
Expand Down Expand Up @@ -579,6 +542,9 @@ public static class ContainedEntity {
@JoinColumn(name = "CIndexedEmbeddedCast")
private Object containingAsIndexedEmbeddedWithCast;

@Embedded
private ContainedEmbeddable embeddedAssociations;

@ElementCollection
@Embedded
@OrderColumn(name = "idx")
Expand Down Expand Up @@ -683,6 +649,14 @@ public void setContainingAsIndexedEmbeddedWithCast(Object containingAsIndexedEmb
this.containingAsIndexedEmbeddedWithCast = containingAsIndexedEmbeddedWithCast;
}

public ContainedEmbeddable getEmbeddedAssociations() {
return embeddedAssociations;
}

public void setEmbeddedAssociations(ContainedEmbeddable embeddedAssociations) {
this.embeddedAssociations = embeddedAssociations;
}

public List<ContainedEmbeddable> getElementCollectionAssociations() {
return elementCollectionAssociations;
}
Expand Down Expand Up @@ -813,9 +787,9 @@ public PropertyAccessor<ContainedEntity, ContainingEntity> containingAsIndexedEm

@Override
public PropertyAccessor<ContainedEntity, ContainedEmbeddable> embeddedAssociations() {
// See https://hibernate.atlassian.net/browse/HHH-15606
throw primitiveNotSupported();
}
return PropertyAccessor.create( ContainedEntity::setEmbeddedAssociations,
ContainedEntity::getEmbeddedAssociations );
}

@Override
public MultiValuedPropertyAccessor<ContainedEntity,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package org.hibernate.search.integrationtest.mapper.orm.automaticindexing.association.bytype.onetoone.ownedbycontaining;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assume.assumeTrue;

import java.lang.reflect.Method;
import java.util.ArrayList;
Expand Down Expand Up @@ -88,57 +87,6 @@ protected boolean isAssociationLazyOnContainingSide() {
return false;
}

@Override
protected boolean includeEmbeddedAssociationsInSchema() {
// See https://hibernate.atlassian.net/browse/HHH-15606
return false;
}

@Override
public void directAssociationUpdate_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void directEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectAssociationUpdate_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectAssociationUpdate_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectEmbeddedAssociationReplace_embeddedAssociationsIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

@Override
public void indirectEmbeddedAssociationReplace_embeddedAssociationsNonIndexedEmbedded() {
notTestedBecauseOfHHH15606();
}

private void notTestedBecauseOfHHH15606() {
assumeTrue( "This test is disabled because of https://hibernate.atlassian.net/browse/HHH-15606",
false );
}

@Override
public void setup(OrmSetupHelper.SetupContext setupContext,
ReusableOrmSetupHolder.DataClearConfig dataClearConfig) {
Expand Down Expand Up @@ -189,6 +137,9 @@ public static class ContainingEntity {
"containedIndexedEmbeddedNoReindexOnUpdate.indexedElementCollectionField",
"containedIndexedEmbeddedNoReindexOnUpdate.containedDerivedField",
"containedIndexedEmbeddedWithCast.indexedField",
"embeddedAssociations.containedIndexedEmbedded.indexedField",
"embeddedAssociations.containedIndexedEmbedded.indexedElementCollectionField",
"embeddedAssociations.containedIndexedEmbedded.containedDerivedField",
"elementCollectionAssociations.containedIndexedEmbedded.indexedField",
"elementCollectionAssociations.containedIndexedEmbedded.indexedElementCollectionField",
"elementCollectionAssociations.containedIndexedEmbedded.containedDerivedField",
Expand Down Expand Up @@ -224,6 +175,10 @@ public static class ContainingEntity {
@IndexedEmbedded(includePaths = { "indexedField" }, targetType = ContainedEntity.class)
private Object containedIndexedEmbeddedWithCast;

@IndexedEmbedded
@Embedded
private ContainingEmbeddable embeddedAssociations;

@IndexedEmbedded
@ElementCollection
@Embedded
Expand Down Expand Up @@ -314,6 +269,14 @@ public void setContainedIndexedEmbeddedWithCast(Object containedIndexedEmbeddedW
this.containedIndexedEmbeddedWithCast = containedIndexedEmbeddedWithCast;
}

public ContainingEmbeddable getEmbeddedAssociations() {
return embeddedAssociations;
}

public void setEmbeddedAssociations(ContainingEmbeddable embeddedAssociations) {
this.embeddedAssociations = embeddedAssociations;
}

public List<ContainingEmbeddable> getElementCollectionAssociations() {
return elementCollectionAssociations;
}
Expand Down Expand Up @@ -402,8 +365,9 @@ public PropertyAccessor<ContainingEntity, ContainedEntity> containedIndexedEmbed

@Override
public PropertyAccessor<ContainingEntity, ContainingEmbeddable> embeddedAssociations() {
throw primitiveNotSupported();
}
return PropertyAccessor.create( ContainingEntity::setEmbeddedAssociations,
ContainingEntity::getEmbeddedAssociations );
}

@Override
public MultiValuedPropertyAccessor<ContainingEntity,
Expand Down Expand Up @@ -528,6 +492,9 @@ public static class ContainedEntity {
@LazyGroup("containingAsIndexedEmbeddedWithCast")
private Object containingAsIndexedEmbeddedWithCast;

@Embedded
private ContainedEmbeddable embeddedAssociations;

/*
* No mappedBy here. The inverse side of associations within an element collection cannot use mappedBy.
* If they do, Hibernate ORM will fail (throw an exception) while attempting to walk down the mappedBy path,
Expand Down Expand Up @@ -655,6 +622,14 @@ public void setContainingAsIndexedEmbeddedWithCast(Object containingAsIndexedEmb
this.containingAsIndexedEmbeddedWithCast = containingAsIndexedEmbeddedWithCast;
}

public ContainedEmbeddable getEmbeddedAssociations() {
return embeddedAssociations;
}

public void setEmbeddedAssociations(ContainedEmbeddable embeddedAssociations) {
this.embeddedAssociations = embeddedAssociations;
}

public ContainingEntity getContainingAsElementCollectionAssociationsIndexedEmbedded() {
return containingAsElementCollectionAssociationsIndexedEmbedded;
}
Expand Down Expand Up @@ -801,8 +776,9 @@ public PropertyAccessor<ContainedEntity, ContainingEntity> containingAsIndexedEm

@Override
public PropertyAccessor<ContainedEntity, ContainedEmbeddable> embeddedAssociations() {
throw primitiveNotSupported();
}
return PropertyAccessor.create( ContainedEntity::setEmbeddedAssociations,
ContainedEntity::getEmbeddedAssociations );
}

@Override
public PropertyAccessor<ContainedEntity,
Expand Down

0 comments on commit 557843c

Please sign in to comment.