Skip to content

[master] Fixing some minor warnings and errors in JPA tests #364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions antbuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1581,10 +1581,10 @@
<target name="test-jpa" description="run the jpa tests">
<ant antfile="antbuild.xml" dir="${eclipselink.jpa.test}" target="test-lrg"/>
</target>
<target name="test-jpa21" description="run the jpa tests">
<target name="test-jpa21" description="run the jpa 21 tests">
<ant antfile="antbuild.xml" dir="${eclipselink.jpa.test}" target="test-lrg"/>
</target>
<target name="test-jpa22" description="run the jpa tests">
<target name="test-jpa22" description="run the jpa 22 tests">
<ant antfile="antbuild.xml" dir="${eclipselink.jpa.test}" target="test-lrg22"/>
</target>
<!-- Run JPA SRG. -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -19,7 +20,6 @@
import org.eclipse.persistence.sessions.coordination.RemoteCommandManager;
import org.eclipse.persistence.sessions.coordination.TransportManager;
import org.eclipse.persistence.testing.tests.distributedservers.rcm.ConfigurableCacheSyncDistributedTest;
import org.junit.Assert;

import java.lang.reflect.Field;

Expand All @@ -38,9 +38,9 @@ protected void test() throws Throwable {
RemoteConnection connection = transport.getConnectionToLocalHost();
try {
int multicastPort = getMulticastPort(connection);
Assert.assertEquals("Default multicast port different than expected", 45588, multicastPort);
assertEquals("Default multicast port different than expected", 45588, multicastPort);
} catch (Exception x) {
Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
fail("Failed to retrieve multicast port: " + x.getMessage());
} finally {
connection.close();
}
Expand All @@ -53,9 +53,9 @@ protected void test() throws Throwable {
connection = transport.getConnectionToLocalHost();
try {
int multicastPort = getMulticastPort(connection);
Assert.assertEquals("Configured multicast port different than expected", 45678, multicastPort);
assertEquals("Configured multicast port different than expected", 45678, multicastPort);
} catch (Exception x) {
Assert.fail("Failed to retrieve multicast port: " + x.getMessage());
fail("Failed to retrieve multicast port: " + x.getMessage());
} finally {
connection.close();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -24,7 +25,6 @@

//JUnit4 imports
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -90,7 +90,7 @@ protected void assertDefaultValues(DynamicEntity simpleInstance) {
@Override
public DynamicEntity createSimpleInstance(Session session, int id) {
DynamicType simpleEntityType = dynamicHelper.getType("Simple");
Assert.assertNotNull(simpleEntityType);
assertNotNull(simpleEntityType);

DynamicEntity simpleInstance = simpleEntityType.newDynamicEntity();
simpleInstance.set("id1", id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -25,7 +26,6 @@
//JUnit4 imports
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -162,7 +162,7 @@ protected void assertDefaultValues(DynamicEntity simpleInstance) {

public DynamicEntity createSimpleInstance(Session session, int id) {
DynamicType simpleEntityType = dynamicHelper.getType("Simple");
Assert.assertNotNull(simpleEntityType);
assertNotNull(simpleEntityType);

DynamicEntity simpleInstance = simpleEntityType.newDynamicEntity();
simpleInstance.set("id", id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2011, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand All @@ -26,7 +27,6 @@
//JUnit4 imports
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down Expand Up @@ -174,7 +174,7 @@ protected void assertDefaultValues(DynamicEntity simpleInstance) {

public DynamicEntity createSimpleInstance(Session session, int id) {
DynamicType simpleEntityType = dynamicHelper.getType("Simple");
Assert.assertNotNull(simpleEntityType);
assertNotNull(simpleEntityType);

DynamicEntity simpleInstance = simpleEntityType.newDynamicEntity();
simpleInstance.set("id", id);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -38,7 +39,6 @@
import org.eclipse.persistence.sessions.UnitOfWork;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

Expand Down Expand Up @@ -147,7 +147,7 @@ public void verifyConfig() throws Exception {
@Test
public void verifyProperties() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

assertEquals(4, simpleTypeA.getNumberOfProperties());
assertEquals("id", simpleTypeA.getPropertiesNames().get(0));
Expand All @@ -159,7 +159,7 @@ public void verifyProperties() {
@Test
public void createSimpleA() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

DynamicEntity a = simpleTypeA.newDynamicEntity();

Expand All @@ -179,7 +179,7 @@ public void createSimpleA() {
@Test
public void persistSimpleA() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

DynamicEntity simpleInstance = simpleTypeA.newDynamicEntity();
simpleInstance.set("id", 1);
Expand All @@ -193,15 +193,15 @@ public void persistSimpleA() {
countQuery.addCount();
countQuery.setShouldReturnSingleValue(true);
int simpleCount = ((Number) session.executeQuery(countQuery)).intValue();
Assert.assertEquals(1, simpleCount);
assertEquals(1, simpleCount);
}

@Test
public void verifyChangTracking() {
persistSimpleA();

DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

UnitOfWork uow = session.acquireUnitOfWork();

Expand All @@ -227,11 +227,11 @@ public void verifyChangTracking() {
@Test
public void createSimpleAwithSimpleB() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);
DynamicType simpleTypeB = dynamicHelper.getType("SimpleB");
Assert.assertNotNull(simpleTypeB);
assertNotNull(simpleTypeB);

Assert.assertNotNull(session.getDescriptorForAlias("SimpleB"));
assertNotNull(session.getDescriptorForAlias("SimpleB"));

DynamicEntity simpleInstanceB = simpleTypeB.newDynamicEntity();
simpleInstanceB.set("value2", true);
Expand All @@ -251,7 +251,7 @@ public void createSimpleAwithSimpleB() {
countQuery.setShouldReturnSingleValue(true);

int simpleCountA = ((Number) session.executeQuery(countQuery)).intValue();
Assert.assertEquals(1, simpleCountA);
assertEquals(1, simpleCountA);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -29,7 +30,6 @@
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.Assert;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

Expand Down Expand Up @@ -141,7 +141,7 @@ public void createSimpleA() {
countQuery.addCount();
countQuery.setShouldReturnSingleValue(true);
int simpleCount = ((Number) session.executeQuery(countQuery)).intValue();
Assert.assertEquals(1, simpleCount);
assertEquals(1, simpleCount);
}

@Test
Expand All @@ -158,7 +158,7 @@ public void createSimpleB() {
countQuery.addCount();
countQuery.setShouldReturnSingleValue(true);
int simpleCount = ((Number) session.executeQuery(countQuery)).intValue();
Assert.assertEquals(1, simpleCount);
assertEquals(1, simpleCount);
}

@Test
Expand All @@ -181,13 +181,13 @@ public void createAwithB() {
countQueryB.addCount();
countQueryB.setShouldReturnSingleValue(true);
int simpleCountB = ((Number) session.executeQuery(countQueryB)).intValue();
Assert.assertEquals(1, simpleCountB);
assertEquals(1, simpleCountB);

ReportQuery countQueryA = dynamicHelper.newReportQuery("SimpleA", new ExpressionBuilder());
countQueryA.addCount();
countQueryA.setShouldReturnSingleValue(true);
int simpleCountA = ((Number) session.executeQuery(countQueryA)).intValue();
Assert.assertEquals(1, simpleCountA);
assertEquals(1, simpleCountA);
}

@Ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 1998, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
Expand Down Expand Up @@ -36,7 +37,6 @@
import org.eclipse.persistence.sessions.UnitOfWork;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

Expand Down Expand Up @@ -122,7 +122,7 @@ public void verifyConfig() throws Exception {
@Test
public void verifyProperties() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

assertEquals(6, simpleTypeA.getNumberOfProperties());
assertTrue(simpleTypeA.getPropertiesNames().contains("id"));
Expand All @@ -143,23 +143,23 @@ public void verifyProperties() {
@Test
public void createSimpleA() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

DynamicEntity a = simpleTypeA.newDynamicEntity();

assertNotNull(a);
assertEquals(((Number) a.get("id")).intValue(), 0);
assertFalse(a.isSet("value1"));
assertEquals(a.get("value2"), false);
assertEquals(false, a.get("value2"));
assertFalse(a.isSet("value3"));
assertEquals(((Number) a.get("value4")).doubleValue(), 0.0, 0.01);
assertEquals(0.0, ((Number) a.get("value4")).doubleValue(), 0.01);
assertFalse(a.isSet("value5"));
}

@Test
public void persistSimpleA() {
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

DynamicEntity simpleInstance = simpleTypeA.newDynamicEntity();
simpleInstance.set("id", 1);
Expand All @@ -173,7 +173,7 @@ public void persistSimpleA() {
countQuery.addCount();
countQuery.setShouldReturnSingleValue(true);
int simpleCount = ((Number) session.executeQuery(countQuery)).intValue();
Assert.assertEquals(1, simpleCount);
assertEquals(1, simpleCount);

session.release();
}
Expand All @@ -182,7 +182,7 @@ public void persistSimpleA() {
public void verifyChangeTracking() {
persistSimpleA();
DynamicType simpleTypeA = dynamicHelper.getType("SimpleA");
Assert.assertNotNull(simpleTypeA);
assertNotNull(simpleTypeA);

UnitOfWork uow = session.acquireUnitOfWork();

Expand Down
Loading