Skip to content

Commit

Permalink
Blazebit#414 - Datanucleus, MySQL, Oracle and DB2 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Nov 6, 2017
1 parent 5844f56 commit 72357e2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
Expand Up @@ -17,6 +17,7 @@
package com.blazebit.persistence.testsuite.entity;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
Expand All @@ -29,8 +30,7 @@
/**
*
* @author Christian Beikov
* @author Moritz Becker
* @since 1.0
* @since 1.2.0
*/
@Entity
@Table(name = "blob_tbl")
Expand Down Expand Up @@ -71,6 +71,7 @@ public void setVersion(Long version) {
}

@Lob
@Column(name = "blob_col")
public Blob getBlob() {
return blob;
}
Expand Down
3 changes: 1 addition & 2 deletions entity-view/testsuite/pom.xml
Expand Up @@ -48,7 +48,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>blaze-persistence-core-testsuite</artifactId>
<version>${project.version}</version>
<scope>test</scope>
<exclusions>
<!-- I honestly don't know why, but the default profile seems to be actived for that dependency -->
<exclusion>
Expand Down Expand Up @@ -247,7 +246,7 @@
<configuration>
<excludedGroups>com.blazebit.persistence.testsuite.base.category.NoDB2,${jpa.excludedGroups}</excludedGroups>
<systemPropertyVariables>
<jdbc.url>jdbc:db2://localhost:50000/test</jdbc.url>
<jdbc.url>jdbc:db2://localhost:50000/test:progressiveStreaming=2</jdbc.url>
<jdbc.user>db2inst1</jdbc.user>
<jdbc.password>db2inst1-pwd</jdbc.password>
<jdbc.driver>com.ibm.db2.jcc.DB2Driver</jdbc.driver>
Expand Down
Expand Up @@ -16,6 +16,8 @@

package com.blazebit.persistence.view.testsuite.proxy;

import com.blazebit.persistence.testsuite.base.category.NoDatanucleus;
import com.blazebit.persistence.testsuite.base.category.NoEclipselink;
import com.blazebit.persistence.testsuite.entity.EmbeddableTestEntity;
import com.blazebit.persistence.testsuite.entity.EmbeddableTestEntityEmbeddable;
import com.blazebit.persistence.testsuite.entity.EmbeddableTestEntityId;
Expand All @@ -32,15 +34,18 @@
import com.blazebit.persistence.view.testsuite.proxy.model.UpdatableEmbeddableTestEntityView;
import com.blazebit.persistence.view.testsuite.proxy.model.UpdatableNameObjectView;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;

/**
*
* @author Christian Beikov
* @since 1.0
* @since 1.2.0
*/
// NOTE: No Datanucleus support yet
@Category({ NoDatanucleus.class, NoEclipselink.class})
public class ProxyFactoryEmeddableTest extends AbstractEntityViewTest {

@Override
Expand Down
Expand Up @@ -20,6 +20,7 @@
import com.blazebit.persistence.testsuite.base.category.NoDatanucleus;
import com.blazebit.persistence.testsuite.base.category.NoEclipselink;
import com.blazebit.persistence.testsuite.entity.BlobEntity;
import com.blazebit.persistence.testsuite.tx.TxVoidWork;
import com.blazebit.persistence.view.EntityViewSetting;
import com.blazebit.persistence.view.FlushMode;
import com.blazebit.persistence.view.FlushStrategy;
Expand All @@ -31,6 +32,7 @@
import org.junit.runners.Parameterized;

import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.OutputStream;
Expand Down Expand Up @@ -203,8 +205,8 @@ public void testSetBlob() throws Exception {
builder.update(BlobEntity.class);
builder.validate();

restartTransactionAndReload();
assertEquals(1, docView.getBlob().length());
restartTransactionAndReload();
assertEquals(1, entity.getBlob().length());
}

Expand All @@ -222,7 +224,18 @@ public void testUpdateBlob() throws Exception {

// When
docView.getBlob().setBytes(1, new byte[2]);
update(docView);
transactional(new TxVoidWork() {

@Override
public void work(EntityManager em) {
// Required for Oracle
em.createQuery("SELECT e FROM BlobEntity e", BlobEntity.class).setLockMode(LockModeType.PESSIMISTIC_WRITE).getSingleResult();
em.clear();
clearQueries();
evm.update(em, docView);
em.flush();
}
});

// Then
AssertStatementBuilder builder = assertQuerySequence();
Expand Down
Expand Up @@ -25,6 +25,7 @@
<!-- <class>com.blazebit.persistence.view.collections.entity.extended.ExtendedPersonForCollections</class> -->
<!-- <class>com.blazebit.persistence.view.collections.entity.extended.ExtendedPersonForElementCollections</class> -->
<class>com.blazebit.persistence.view.testsuite.entity.EmbeddableTestEntity</class>
<class>com.blazebit.persistence.view.testsuite.entity.EmbeddableTestEntityEmbeddable</class>
<class>com.blazebit.persistence.view.testsuite.entity.TestEntity</class>

<class>com.blazebit.persistence.view.testsuite.entity.LegacyOrder</class>
Expand Down

0 comments on commit 72357e2

Please sign in to comment.