-
-
Couldn't load subscription status.
- Fork 3.7k
HHH-19846 - Drop JUnit 4 usage #11102
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
Conversation
hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytoone/ManyToOneTest.java
Fixed
Show fixed
Hide fixed
...e-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java
Fixed
Show fixed
Hide fixed
|
|
||
| ); | ||
| factoryScope.inTransaction( (session) -> session.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| final ResultSet resultSet = statement.executeQuery( | ||
| "select count(*) from farm_accreditations" ); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| ) | ||
| ); | ||
| factoryScope.inTransaction((s) -> s.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| ) | ||
| ); | ||
| factoryScope.inTransaction((s) -> s.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| ); | ||
| factoryScope.inTransaction((s) -> s.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); | ||
| final ResultSet resultSet = statement.executeQuery( "select count(*) from human_nick_names" ); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| ) | ||
| ); | ||
| factoryScope.inTransaction( s -> s.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| ); | ||
| factoryScope.inTransaction( s -> s.doWork( (connection) -> { | ||
| final Statement statement = connection.createStatement(); | ||
| final ResultSet resultSet = statement.executeQuery( "select count(*) from human_nick_names" ); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| this.name=name; | ||
| } | ||
| public Map getManagerBySite() { | ||
| public Map<Site,Employee> getManagerBySite() { |
Check notice
Code scanning / CodeQL
Exposing internal representation
e204062 to
3ab1246
Compare
| @Override | ||
| public StandardServiceRegistry produceServiceRegistry(StandardServiceRegistryBuilder builder) { | ||
| try { | ||
| var dropOutput = File.createTempFile( "drop_script", ".sql" ); |
Check warning
Code scanning / CodeQL
Local information disclosure in a temporary directory
| public StandardServiceRegistry produceServiceRegistry(StandardServiceRegistryBuilder builder) { | ||
| try { | ||
| var dropOutput = File.createTempFile( "drop_script", ".sql" ); | ||
| var createOutput = File.createTempFile( "create_script", ".sql" ); |
Check warning
Code scanning / CodeQL
Local information disclosure in a temporary directory
| public void testBooleanType() { | ||
| final Boolean original = Boolean.TRUE; | ||
| //noinspection UnnecessaryBoxing,removal,BooleanConstructorCall |
Check notice
Code scanning / CodeQL
Inefficient primitive constructor
hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/ServiceRegistryProducer.java
Fixed
Show fixed
Hide fixed
| private MetadataImplementor metadata; | ||
| private final List<AutoCloseable> toClose = new ArrayList<>(); | ||
| private SessionFactoryImplementor sessionFactory; | ||
| private SessionFactoryScope factoryScope; |
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| private final List<AutoCloseable> toClose = new ArrayList<>(); | ||
| private SessionFactoryImplementor sessionFactory; | ||
| private SessionFactoryScope factoryScope; | ||
|
|
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| private SessionFactoryImplementor sessionFactory; | ||
| private SessionFactoryScope factoryScope; | ||
|
|
||
| private final List<AutoCloseable> autoCloseables = new ArrayList<>(); |
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| private SessionFactoryScope factoryScope; | ||
|
|
||
| private final List<AutoCloseable> autoCloseables = new ArrayList<>(); | ||
|
|
Check warning
Code scanning / CodeQL
Unsafe use of getResource
|
|
||
| private final List<AutoCloseable> autoCloseables = new ArrayList<>(); | ||
|
|
||
| public DefaultCatalogAndSchemaTest(Options options) { |
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| private final List<AutoCloseable> autoCloseables = new ArrayList<>(); | ||
|
|
||
| public DefaultCatalogAndSchemaTest(Options options) { | ||
| this.options = options; |
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-catalog-placeholder.orm.xml" ) ); | ||
| metadataSources.addInputStream( getClass().getResourceAsStream( "database-object-using-schema-placeholder.orm.xml" ) ); | ||
| if ( options.xmlMapping != null ) { | ||
| metadataSources.addInputStream( getClass().getResourceAsStream( options.xmlMapping ) ); |
Check warning
Code scanning / CodeQL
Unsafe use of getResource
| ) | ||
| @DomainModel(annotatedClasses = TheEntity.class) | ||
| @SessionFactory | ||
| public void testIt(CdiContainerScope containerScope, SessionFactoryScope factoryScope) { |
Check notice
Code scanning / CodeQL
Useless parameter
| )) | ||
| @DomainModel(annotatedClasses = TheEntity.class) | ||
| @SessionFactory | ||
| public void testAnnotations(CdiContainerScope containerScope, SessionFactoryScope factoryScope) { |
Check notice
Code scanning / CodeQL
Useless parameter
| )) | ||
| @DomainModel(annotatedClasses = TheEntity.class, xmlMappings = "org/hibernate/test/cdi/converters/orm.xml") | ||
| @SessionFactory | ||
| public void testOrmXml(CdiContainerScope cdiScope, SessionFactoryScope factoryScope) { |
Check notice
Code scanning / CodeQL
Useless parameter
| } | ||
|
|
||
| interface SettingResolver { | ||
| Object resolve(StandardServiceRegistryBuilder registryBuilder, ExtensionContext junitContext); |
Check notice
Code scanning / CodeQL
Useless parameter
| long count = session.doReturningWork( (connection) -> { | ||
| // in this current form, users must handle try/catches themselves for proper resource release | ||
| Statement statement = null; | ||
| long personCount = 0; | ||
| try { | ||
| statement = session.getJdbcCoordinator().getStatementPreparer().createStatement(); | ||
| ResultSet resultSet = null; | ||
| try { | ||
| resultSet = session.getJdbcCoordinator().getResultSetReturn().extract( statement, "select count(*) from T_JDBC_PERSON" ); | ||
| resultSet.next(); | ||
| personCount = resultSet.getLong( 1 ); | ||
| assertEquals( 1L, personCount ); | ||
| } | ||
| finally { | ||
| releaseQuietly( session, resultSet, statement ); | ||
| } | ||
| } | ||
| ); | ||
| session2.getTransaction().commit(); | ||
| session2.close(); | ||
| assertEquals( 1L, count ); | ||
|
|
||
| session = openSession(); | ||
| session.beginTransaction(); | ||
| session.remove( p ); | ||
| session.getTransaction().commit(); | ||
| session.close(); | ||
| finally { | ||
| releaseQuietly( session, statement ); | ||
| } | ||
| return personCount; | ||
| } ); |
Check notice
Code scanning / CodeQL
Unread local variable
| finally { | ||
| session.close(); | ||
| factoryScope.inTransaction( session, (s) -> session.doWork( connection -> { | ||
| final Statement stmnt = connection.createStatement(); |
Check warning
Code scanning / CodeQL
Potential database resource leak
| persistenceContext.getCollectionsByKey().values().contains( publisher.getAuthors() ) ); | ||
| Assertions.assertEquals( 0, actionQueue.numberOfCollectionRemovals() ); | ||
|
|
||
| Set<Author> authorsOld = publisher.getAuthors(); |
Check notice
Code scanning / CodeQL
Unread local variable
| List<Object> objects = session.createQuery( | ||
| "from java.lang.Object", | ||
| Object.class) | ||
| .getResultList(); | ||
| "from java.lang.Object", | ||
| Object.class) | ||
| .getResultList(); |
Check notice
Code scanning / CodeQL
Unread local variable
| List<Person> persons = session.createQuery( | ||
| "from Person", Person.class) | ||
| .getResultList(); | ||
| "from Person", Person.class) | ||
| .getResultList(); |
Check notice
Code scanning / CodeQL
Unread local variable
| LocalDateTime datetime = session.createQuery( | ||
| "select local datetime", | ||
| LocalDateTime.class) | ||
| .getSingleResult(); | ||
| "select local datetime", | ||
| LocalDateTime.class) | ||
| .getSingleResult(); |
Check notice
Code scanning / CodeQL
Unread local variable
| public void test_jpql_api_named_query_example() { | ||
| doInJPA(this::entityManagerFactory, entityManager -> { | ||
| public void test_jpql_api_named_query_example(SessionFactoryScope factoryScope) { | ||
| factoryScope.inTransaction( entityManager -> { |
Check notice
Code scanning / CodeQL
Unread local variable
| List<Person> persons = personStream | ||
| .skip(5) | ||
| .limit(5) | ||
| .collect(Collectors.toList()); | ||
| .toList(); |
Check notice
Code scanning / CodeQL
Unread local variable
| public void test_hql_api_positional_parameter_example() { | ||
| doInJPA(this::entityManagerFactory, entityManager -> { | ||
| @Test | ||
| @ExpectedException( IllegalArgumentException.class ) |
Check notice
Code scanning / CodeQL
Unread local variable
Check notice
Code scanning / CodeQL
Unread local variable
| var detached = TransactionUtil.fromTransaction( sessionFactory(), (s) -> { | ||
| A aGet = s.find( A.class, 1 ); | ||
| aGet.name = "A. Name"; | ||
| return aGet; | ||
| } ); |
Check notice
Code scanning / CodeQL
Unread local variable
| var detached = TransactionUtil.fromTransaction( sessionFactory(), (s) -> { | ||
| A aGet = s.find( A.class, 2 ); | ||
| aGet.name = "A. Name"; | ||
| return aGet; | ||
| } ); |
Check notice
Code scanning / CodeQL
Unread local variable
c8f2a53 to
d72d436
Compare
|
|
||
| public Set getSuites() { | ||
| public Set<Suite> getSuites() { | ||
| return suites; |
Check notice
Code scanning / CodeQL
Exposing internal representation
| public Set getAddresses() { | ||
| public Set<Address> getAddresses() { | ||
| return addresses; | ||
| } |
Check notice
Code scanning / CodeQL
Exposing internal representation
| public Collection getFriends() { | ||
| public Collection<Person> getFriends() { | ||
| return friends; | ||
| } |
Check notice
Code scanning / CodeQL
Exposing internal representation
5b4a720 to
3d1dc3b
Compare
Dropping usage of JUnit 4
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19846