Skip to content

Commit

Permalink
Replaced with new maven project for no diagnostics test
Browse files Browse the repository at this point in the history
  • Loading branch information
aparnamichael committed Jul 17, 2023
1 parent eb7861a commit 0889304
Show file tree
Hide file tree
Showing 42 changed files with 106 additions and 175 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.openliberty</groupId>
<artifactId>demo-servlet-no-diagnostics</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>demo-servlet-no-diagnostics</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import jakarta.fake.context.ApplicationScoped;

import jakarta.enterprise.inject.Disposes;
import jakarta.fake.inject.Disposes;

@ApplicationScoped
public class MultipleDisposes {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.openliberty.sample.jakarta.servlet;

import jakarta.fake.fakeException;
import jakarta.fake.ServletException;
import jakarta.fake.annotation.WebServlet;
import jakarta.fake.http.Httpfake;
import jakarta.fake.http.HttpServlet;
import jakarta.fake.http.HttpServletRequest;
import jakarta.fake.http.HttpServletResponse;
import java.io.IOException;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

import static org.eclipse.lsp4jakarta.jdt.core.JakartaForJavaAssert.assertJavaDiagnostics;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.Path;
Expand All @@ -42,7 +45,7 @@ public void checkForNoDiagnostics() throws Exception {

JDTUtils utils = JDT_UTILS;

IJavaProject javaProject = loadJavaProject("jakarta-noDiagnostic-sample", "");
IJavaProject javaProject = loadJavaProject("demo-servlet-no-diagnostics", "");
IFile javaFile = javaProject.getProject()
.getFile(new Path(filePath));
String uri = javaFile.getLocation().toFile().toURI().toString();
Expand All @@ -57,62 +60,29 @@ public void checkForNoDiagnostics() throws Exception {

// list of java files in demo-servlet-no-diagnostics.
@Parameters
public static String[] projectFileProvider() throws Exception {

String basePath = "src/main/java/io/openliberty/sample/jakarta/";
String files[] = { basePath + "annotations/GeneratedAnnotation.java",
basePath + "annotations/PostConstructAnnotation.java",
basePath + "annotations/PreDestroyAnnotation.java",
basePath + "annotations/ResourceAnnotation.java",

basePath + "beanvalidation/FieldConstraintValidation.java",
basePath + "beanvalidation/MethodConstraintValidation.java",
basePath + "beanvalidation/ValidConstraints.java",

basePath + "cdi/InjectAndDisposesObservesObservesAsync.java",
basePath + "cdi/ManagedBean.java",
basePath + "cdi/ManagedBeanConstructor.java",
basePath + "cdi/MultipleDisposes.java",
basePath + "cdi/ProducesAndDisposesObservesObservesAsync.java",
basePath + "cdi/ProducesAndInjectTogether.java",
basePath + "cdi/ScopeDeclaration.java",

basePath + "di/Greeting.java",
basePath + "di/MultipleConstructorWithInject.java",

basePath + "jax_rs/MultipleEntityParamsResourceMethod.java",
basePath + "jax_rs/NoPublicConstructorClass.java",
basePath + "jax_rs/NoPublicConstructorProviderClass.java",
basePath + "jax_rs/NotPublicResourceMethod.java",
basePath + "jax_rs/RootResourceClassConstructorsDiffLen.java",
basePath + "jax_rs/RootResourceClassConstructorsEqualLen.java",

basePath + "jsonb/ExtraJsonbCreatorAnnotations.java",
basePath + "jsonb/JsonbTransientDiagnostic.java",

basePath + "jsonp/CreatePointerInvalidTarget.java",

basePath + "persistence/EntityMissingConstructor.java",
basePath + "persistence/FinalModifiers.java",
basePath + "persistence/MapKeyAndMapKeyClassTogether.java",
basePath + "persistence/MultipleMapKeyAnnotations.java",

basePath + "servlet/DontExtendHttpServlet.java",
basePath + "servlet/InvalidWebServlet.java",

basePath + "websocket/AnnotationTest.java",
basePath + "websocket/DuplicateOnMessage.java",
basePath + "websocket/InvalidParamType.java",
basePath + "websocket/ServerEndpointDuplicateVariableURI.java",
basePath + "websocket/ServerEndpointInvalidTemplateURI.java",
basePath + "websocket/ServerEndpointNoSlash.java",
basePath + "websocket/ServerEndpointRelativePathTest.java",

basePath + "websockets/PathParamURIWarningTest.java"
};

return files;

public static List<String> projectFileProvider() throws Exception {

String packagePath = "src/main/java/io/openliberty/sample/jakarta/";
String basePath = System.getProperty("user.dir")
+ "/projects/demo-servlet-no-diagnostics/" + packagePath;

List<String> results = new ArrayList<String>();
File[] directories = new File(basePath).listFiles();
// If this pathname does not denote a directory, then listFiles() returns null.

for (File directory : directories) {
// Check for directory.
if (directory.isDirectory()) {
File[] files = new File(basePath + "/" + directory.getName() + "/").listFiles();
for (File file : files) {
if (file.isFile()) {
// Add test file path.
results.add(packagePath + directory.getName() + "/" + file.getName());
}
}
}

}
return results;
}

}

0 comments on commit 0889304

Please sign in to comment.