-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* windup-2203 added rules , tests and 2 test files * windup-2203 added more info on test files, and tweaked a bit the rule * windup-2203 fixed typo on the rule test for JACC * windup-2203 added rules and tests for Servlet and JSON-B * windup-2203 added test file * windup-2203 added iterable-filter to the rule tests in order to explicitly check the number of ocurrences * windup-2203 [PR] fixed typo
- Loading branch information
1 parent
f063195
commit eaaf008
Showing
7 changed files
with
394 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
rules-reviewed/technology-usage/tests/data/javaee/JavaServlet.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.jboss.windup.test; | ||
|
||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
public class JavaServlet extends HttpServlet { | ||
|
||
/** | ||
* Example | ||
* @param request | ||
* @param response | ||
* @throws ServletException | ||
* @throws IOException | ||
*/ | ||
@Override | ||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
response.setContentType("text/html"); | ||
PrintWriter out = response.getWriter(); | ||
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">"); | ||
out.println("<html>"); | ||
out.println("<head><title>Example Title</title></head>"); | ||
out.println("<body>"); | ||
out.println("<h1>¡Hi!</h1>"); | ||
out.println("</body></html>"); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
rules-reviewed/technology-usage/tests/data/javaee/JsonBinding.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.jboss.windup.test; | ||
import javax.json.bind.annotation.JsonbProperty; | ||
import javax.json.bind.annotation.JsonbTransient; | ||
import javax.json.bind.annotation.JsonbDateFormat; | ||
import javax.json.bind.annotation.JsonbNumberFormat; | ||
|
||
public class JsonBinding { | ||
|
||
private int id; | ||
|
||
@JsonbProperty("person-name") | ||
private String name; | ||
|
||
@JsonbProperty(nillable = true) | ||
private String email; | ||
|
||
@JsonbTransient | ||
private int age; | ||
|
||
@JsonbDateFormat("dd-MM-yyyy") | ||
private LocalDate registeredDate; | ||
|
||
private BigDecimal salary; | ||
|
||
@JsonbNumberFormat(locale = "en_US", value = "#0.0") | ||
public BigDecimal getSalary() { | ||
return salary; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
rules-reviewed/technology-usage/tests/data/javaee/Security.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.jboss.windup.test; | ||
|
||
import javax.management.j2ee.Management; | ||
import javax.management.j2ee.ManagementHome; | ||
import javax.naming.Context; | ||
import javax.naming.InitialContext; | ||
import javax.security.jacc.PolicyConfigurationFactory; | ||
|
||
public class MyJaccProviderService { | ||
|
||
|
||
public PolicyConfigurationFactory getPolicyConfigurationFactory() { | ||
PolicyConfigurationFactory pcf = null; | ||
try { | ||
pcf = PolicyConfigurationFactory.getPolicyConfigurationFactory(); | ||
} catch (Exception e) { | ||
return null; | ||
} | ||
return pcf; | ||
} | ||
|
||
public static Management getMEJBRemote() { | ||
Context context = new InitialContext(null); | ||
ManagementHome home = (ManagementHome) context.lookup("ejb.mgmt.MEJB"); | ||
Management bean = home.create(); | ||
return bean; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
rules-reviewed/technology-usage/tests/data/javaee/WebService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.jboss.windup.test; | ||
|
||
import javax.annotation.PostConstruct; | ||
import javax.jws.WebService; | ||
import javax.xml.bind.JAXBContext; | ||
import javax.xml.registry.BulkResponse; | ||
import javax.xml.registry.BusinessLifeCycleManager; | ||
import javax.xml.registry.Connection; | ||
import javax.xml.registry.ConnectionFactory; | ||
import javax.xml.registry.JAXRException; | ||
import javax.xml.registry.RegistryService; | ||
import javax.xml.registry.infomodel.Key; | ||
import javax.xml.registry.infomodel.Organization; | ||
import javax.validation.constraints.NotNull; | ||
|
||
|
||
@WebService() | ||
public class Hello { | ||
@NotNull | ||
private String myAttribute; | ||
|
||
private String message = new String("Hello, "); | ||
|
||
public void Hello() {} | ||
|
||
@WebMethod() | ||
public String sayHello(String name) { | ||
return message + name + "."; | ||
} | ||
|
||
@PostConstruct | ||
public void postConstruct() { | ||
JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" ); | ||
ConnectionFactory connectionFactory = ConnectionFactory.newInstance(); | ||
System.out.println("nothing"); | ||
} | ||
|
||
|
||
|
||
} |
Empty file.
Oops, something went wrong.