Skip to content

Commit

Permalink
Tracking evolution of the ApplicationValidatorTest with the refactoring
Browse files Browse the repository at this point in the history
- Issue: I tried to use mocking, but I have found that it doesn't work well and
  even if, it would not cover too much of the implementation.
- dol and ejb-container have too many relations, in fact the abstraction was
  unusable and worthless (and even undocumented).
  - I can create mocks for interfaces but I can't use them for validator.
  - I can create half-initialized mock of the abstract class, but it throws
    exceptions which take too much time to investigate and finally I find
    that the issue is the mock, not the code I wanted to test.
  - Same would apply for custom implementations (like is the only one,
    ejb-container) - too much details matter.
- In practice: dol should have much better API, OR all descriptors and nodes
  whould move to DOL. They can be extended and used in ejb-container, but must
  have some basic consistent meaningful implementation.
- So I do some basic steps forward now.
- Final result: test covering bug we have noticed in logs + the fix
  not breaking anything else. Side effect result: easier future changes.

Signed-off-by: David Matějček <david.matejcek@omnifish.ee>
  • Loading branch information
dmatej committed Mar 19, 2023
1 parent fb89c21 commit 9bb9ebd
Show file tree
Hide file tree
Showing 3 changed files with 1,021 additions and 0 deletions.
6 changes: 6 additions & 0 deletions appserver/deployment/dol/pom.xml
Expand Up @@ -153,6 +153,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.glassfish.main</groupId>
<artifactId>test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2023 Eclipse Foundation and/or its affiliates. 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
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/

package com.sun.enterprise.deployment.test;

import org.glassfish.tests.utils.junit.HK2JUnit5Extension;
import org.junit.jupiter.api.extension.ExtensionContext;

/**
* @author David Matejcek
*/
public class DolJunit5Extension extends HK2JUnit5Extension {

@Override
public void postProcessTestInstance(final Object testInstance, ExtensionContext context) throws Exception {
super.postProcessTestInstance(testInstance, context);
}
}

0 comments on commit 9bb9ebd

Please sign in to comment.