Overide a BFILE in unit test Quarkus to use H2

26 views Asked by At

I'm confronted with legacy code using an oracle BFILE.

In other applications I successfully used the really powerful rider-cdi test annotations in combination with quarkus-jdbc-h2. I like to continue that strategy. However the BFILE is spoiling this.

My entity class looks like this:


// :

    @Column(name = "FILE_CONTENTS", updatable = true, insertable = true, nullable = false)
    @AttributeAccessor("property")
    @Type(type = "nl.bro.microservices.dlp.orm.common.BfileType")
    private BFILE fileContents;
// :

In which nl.bro.microservices.dlp.orm.common.BfileType implements org.hibernate.usertype.UserType.

My initial thought would be to redefine oracle.sql.BFILE and put it in my src/test/java/ folder. However, that does not seem to do the trick in fooling the classloader to pick that file over the one in the dependencies. I tried to exclude the oracle dependency from surefire (unit test)

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <classpathDependencyExcludes>
                        <classpathDependencyExclude>io.quarkus:quarkus-jdbc-oracle</classpathDependencyExclude>
                    </classpathDependencyExcludes>
                </configuration>
            </plugin>

But quarkus still wants to load Oracle and fails with: ``java.lang.RuntimeException: java.lang.RuntimeException: Failed to load steps from class io.quarkus.jdbc.oracle.deployment.ExtendedCharactersSupport```

Any suggestions?

Entirely skipping the BFILE (ignoring) is an option as well, since the unit test concerns different entities than the ones containing the BFILE

0

There are 0 answers