Skip to content

Commit

Permalink
code format
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed May 19, 2024
1 parent 546fcf0 commit 571c7e6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,21 @@ protected boolean queryHasSecIndexFilter(String namespace, String setName, Query

throw new IllegalArgumentException("The result of conversion is not a Map, expecting only a POJO argument");
}

/**
* Delete all entities of a class or a set.
*
* @param objectsToDelete Each of the objects must be either a Class or a String.
*/
protected void deleteAll(Object... objectsToDelete) {
for (Object toDelete : objectsToDelete) {
if (toDelete instanceof Class<?>) {
template.deleteAll((Class<?>) toDelete);
} else if (toDelete instanceof String) {
template.deleteAll((String) toDelete);
} else {
throw new IllegalArgumentException("Expecting either a Class<?> or a String");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,14 @@ public class AerospikeTemplateInsertTests extends BaseBlockingIntegrationTests {

@BeforeEach
public void beforeEach() {
template.deleteAll(Person.class);
template.deleteAll(OVERRIDE_SET_NAME);
template.deleteAll(CustomCollectionClass.class);
template.deleteAll(DocumentWithByteArray.class);
template.deleteAll(VersionedClass.class);
deleteAll(Person.class, CustomCollectionClass.class, DocumentWithByteArray.class, VersionedClass.class,
OVERRIDE_SET_NAME);
}

@AfterAll
public void afterAll() {
template.deleteAll(Person.class);
template.deleteAll(OVERRIDE_SET_NAME);
template.deleteAll(CustomCollectionClass.class);
template.deleteAll(DocumentWithByteArray.class);
template.deleteAll(VersionedClass.class);
deleteAll(Person.class, CustomCollectionClass.class, DocumentWithByteArray.class, VersionedClass.class,
OVERRIDE_SET_NAME);
}

@Test
Expand Down

0 comments on commit 571c7e6

Please sign in to comment.