diff --git a/README.md b/README.md index a26cb13..60b5550 100644 --- a/README.md +++ b/README.md @@ -1 +1,99 @@ -# sonarqubejava +# Multi-module Apache Maven example + +This project imports JaCoCo's aggregate XML report to be able to report coverage across modules as well as unit test coverage inside the module. + +For a basic example see [basic maven project](../maven-basic/README.md). + +## Usage + +* Build the project, execute all the tests and analyze the project with SonarQube Scanner for Maven: + +```shell + mvn clean verify sonar:sonar +``` + +## Description + +This project consists of 3 modules. + +* [`module1`](module1/pom.xml) and [`module2`](module2/pom.xml) contain "business logic" and related unit tests. + +* [`tests`](tests/pom.xml) module contains integration tests which test functionality using both modules. + `tests` module is also the one which creates the aggregate coverage report imported into SonarQube. + +To generate the report we configure the JaCoCo plugin to attach its agent to the JVM which is executing the tests in the top level [pom](pom.xml). + +This configuration is done in the `` section, so it will be applied on every submodule. + +It is also configured inside the `coverage` profile, so this can be activated as needed (e.g. only in CI pipeline). + +```xml + + + + + org.jacoco + jacoco-maven-plugin + + + + prepare-agent + + + + + + + +``` + +Once we have configured JaCoCo to collect coverage data, we need to generate the XML coverage report to be imported into SonarQube. + +We will use [report-aggregate](https://www.jacoco.org/jacoco/trunk/doc/report-aggregate-mojo.html) goal which collects data from all modules dependent on the `tests` module. + +To achieve this we configure the JaCoCo plugin by configuring execution of `report-aggregate` goal in `verify` phase. + +See [pom.xml](tests/pom.xml) + +```xml + + + + org.jacoco + jacoco-maven-plugin + + + report + + report-aggregate + + verify + + + + + +``` + +This will create a report in `tests/target/site/jacoco-aggregate/jacoco.xml`. To import this report we will set +`sonar.coverage.jacoco.xmlReportPaths` property in every module on which this coverage should be imported + +```xml + + ${project.basedir}/../${aggregate.report.dir} + +``` + +We use `${aggregate.report.dir}` which is defined in the top level [`pom.xml`](pom.xml) to avoid duplicating the location of the report in every module. + +Alternately we can set this property on the command line with the `-D` switch: + +```shell +mvn -Dsonar.coverage.jacoco.xmlReportPaths=C:\projects\sonar-scanning-examples\sonarscanner-maven-aggregate\tests\target\site\jacoco-aggregate\jacoco.xml clean verify sonar:sonar +``` + +We have to use an absolute path, because the report will be imported for each module separately and the path is resolved relative to the module dir. + +## Documentation + +[SonarScanner for Maven](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/) diff --git a/WebContent/CREATE TABLE.docx b/WebContent/CREATE TABLE.docx deleted file mode 100644 index b3462c1..0000000 Binary files a/WebContent/CREATE TABLE.docx and /dev/null differ diff --git a/WebContent/META-INF/MANIFEST.MF b/WebContent/META-INF/MANIFEST.MF deleted file mode 100644 index 5e94951..0000000 --- a/WebContent/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/WebContent/WEB-INF/lib/ojdbc14.jar b/WebContent/WEB-INF/lib/ojdbc14.jar deleted file mode 100644 index 0aa1b51..0000000 Binary files a/WebContent/WEB-INF/lib/ojdbc14.jar and /dev/null differ diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml deleted file mode 100644 index eff6c71..0000000 --- a/WebContent/WEB-INF/web.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - index.jsp - - -com.javatpoint.MyListener - - diff --git a/WebContent/ask.jsp b/WebContent/ask.jsp deleted file mode 100644 index d3f6a07..0000000 --- a/WebContent/ask.jsp +++ /dev/null @@ -1,135 +0,0 @@ - - - - -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -Contact Us - - -
-
- -
-
- - - - -
-
-
- -
- - -
- -
-
-
-

Contact Us

- -

-Adress: H-109,Shakarpur
- -Telephone: 0123456789
- - - -Email: info@company.com
-

-
-
- - - -
- -

Ask Question

-
-
- - -
- -
- -
- -
- -
- -
- -
- - -
- -
- - -
- - -
- - -

Our Clients

- -
- -

-javatpoint.com -

-
- -
- -

-cstpoint.com -

-
-
- - - - - - - - -
-
-
- \ No newline at end of file diff --git a/WebContent/askq.jsp b/WebContent/askq.jsp deleted file mode 100644 index 985a827..0000000 --- a/WebContent/askq.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> - - -<% - - try { - -String name= request.getParameter("name"); -String email= request.getParameter("email"); -String phone= request.getParameter("phone"); -String question= request.getParameter("question"); - -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); - -PreparedStatement ps=con.prepareStatement("insert into quizq values(?,?,?,?)"); -ps.setString(1,name); -ps.setString(2,email); -ps.setString(3,phone); -ps.setString(4,question); - -int s= ps.executeUpdate(); - - -} -catch(Exception e){e.printStackTrace();} - -%> - diff --git a/WebContent/contact.html b/WebContent/contact.html deleted file mode 100644 index 68ff144..0000000 --- a/WebContent/contact.html +++ /dev/null @@ -1,135 +0,0 @@ - - - - -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -Contact Us - - -
-
- -
-
- - - - -
-
-
- -
- - -
- -
-
-
-

Contact Us

- -

-Adress: H-109,Shakarpur
- -Telephone: 0123456789
- - - -Email: info@company.com
-

-
-
- - - -
- -

Contact Us

-
-
- - -
- -
- -
- -
- -
- -
- -
- - - -
- -
- - -
- - -
- - -

Our Clients

- -
- -

-javatpoint.com -

-
- -
- -

-cstpoint.com -

-
-
- - - - - - - - -
-
-
- \ No newline at end of file diff --git a/WebContent/createquiz.jsp b/WebContent/createquiz.jsp deleted file mode 100644 index d9a95af..0000000 --- a/WebContent/createquiz.jsp +++ /dev/null @@ -1,15 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> - -<% try { -String subject= request.getParameter("subject"); -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("insert into quizinfo(subject) values('"+subject+"') " ); -int s= ps.executeUpdate(); - - } -catch(Exception e){e.printStackTrace();} -%> - - diff --git a/WebContent/createquiz1.jsp b/WebContent/createquiz1.jsp deleted file mode 100644 index f98af2c..0000000 --- a/WebContent/createquiz1.jsp +++ /dev/null @@ -1,157 +0,0 @@ - -<%@page import="java.awt.Dialog"%> - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("counter")!=null){ - Integer i=(Integer)request.getAttribute("counter"); - if(i==10){ - request.setAttribute("finished","quiz successfully submitted"); - - %> - - <% - - }} - %> -
- -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various sunject - -
- - - - - - - - - -
Question:
Option1:
Option2:
Option3:
Option4:
Answer:
Description:
-
- - - - -
-
- - -
-

Latest News

-
-
23
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
23
-
-

- we have latest projects uoloaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - diff --git a/WebContent/findname.jsp b/WebContent/findname.jsp deleted file mode 100644 index 5197f66..0000000 --- a/WebContent/findname.jsp +++ /dev/null @@ -1,17 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@ page import="java.sql.*" %> -<% -String n=request.getParameter("val"); -if(n.length()>0){ -try{ -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("select username from quizregister where username='"+n+"'"); -ResultSet rs=ps.executeQuery(); -while(rs.next()){ -out.print("Username already exist"); -} -con.close(); -}catch(Exception e){e.printStackTrace();} -}//end of if -%> \ No newline at end of file diff --git a/WebContent/findname2.jsp b/WebContent/findname2.jsp deleted file mode 100644 index f2f18f8..0000000 --- a/WebContent/findname2.jsp +++ /dev/null @@ -1,28 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@ page import="java.sql.*" %> - - -<% -String n=request.getParameter("val"); -if(n.length()>0){ -try{ -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); - -PreparedStatement ps=con.prepareStatement("select * from quizinfo where subject like '"+n+"%'"); -//ps.setString(1,n); -out.print("
"); -ResultSet rs=ps.executeQuery(); - -out.print(""); -out.print(""); -while(rs.next()){ -out.print(""); -out.print(""); -out.print(""); -} -out.print("
QuizsSubject
Quiz"+rs.getString(2)+""+rs.getString(1)+"
"); -con.close(); -}catch(Exception e){e.printStackTrace();} -}//end of if -%> \ No newline at end of file diff --git a/WebContent/findname3.jsp b/WebContent/findname3.jsp deleted file mode 100644 index 25e3ccd..0000000 --- a/WebContent/findname3.jsp +++ /dev/null @@ -1,14 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@ page import="java.sql.*" %> - - -<% -String n=request.getParameter("val"); -session.setAttribute("quizname",n); -if(n.length()>0){ -out.print("Quiz"+n+" containns 10 Question
Each question is of 1 point

"); -out.print(""); - -} -//end of if -%> \ No newline at end of file diff --git a/WebContent/footer.html b/WebContent/footer.html deleted file mode 100644 index 8be91e2..0000000 --- a/WebContent/footer.html +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/WebContent/get.jsp b/WebContent/get.jsp deleted file mode 100644 index 6d7fca9..0000000 --- a/WebContent/get.jsp +++ /dev/null @@ -1,60 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@ page import="java.sql.*" %> -<%--<%@page import="com.sun.org.apache.bcel.internal.generic.Select"--%> -<%! static int count=0; %> -<%! static int count1=0; %> - - - -<% -String name=(String)session.getAttribute("quizname"); -try{ - - -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -if(count==0){ -PreparedStatement ps1= con.prepareStatement("select min(qid) from quizques where quizname='"+name+"'"); -PreparedStatement ps2= con.prepareStatement("select max(qid) from quizques where quizname='"+name+"'"); -ResultSet rs1= ps1.executeQuery(); -ResultSet rs2=ps2.executeQuery(); -if(rs2.next()){ -count1=rs2.getInt(1); -session.setAttribute("max",count1); -} -if(rs1.next()){ -count=rs1.getInt(1); -session.setAttribute("min",count); - -} -} -if(count>0){ -PreparedStatement ps=con.prepareStatement("select * from quizques where quizname='"+name+"' and qid='"+count+"' "); -ResultSet rs=ps.executeQuery(); -while(rs.next()){ -String question=rs.getString(1); -String option1= rs.getString(2); -String option2= rs.getString(3); -String option3= rs.getString(4); -String option4= rs.getString(5); -session.setAttribute("question",question); -session.setAttribute("option1",option1); -session.setAttribute("option2",option2); -session.setAttribute("option3",option3); -session.setAttribute("option4",option4); -} - -} -System.out.print(count); -count++; -session.setAttribute("count",count); -if(count>(Integer)session.getAttribute("max")){ -count=0; -session.setAttribute("ans",null); -} -con.close(); - -}catch(Exception e){e.printStackTrace();} -//end of if -%> - \ No newline at end of file diff --git a/WebContent/get1.jsp b/WebContent/get1.jsp deleted file mode 100644 index 130ff19..0000000 --- a/WebContent/get1.jsp +++ /dev/null @@ -1,93 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@ page import="java.sql.*" %> -<%-- <%@page import="com.sun.org.apache.bcel.internal.generic.Select"%>--%> - -<%! static int count1=0; %> - -<%! static int total=0; %> -<% -if(session.getAttribute("count")!=null){ -String name=(String)session.getAttribute("quizname"); -String ans= (String)session.getAttribute("ans"); -Integer count=(Integer)session.getAttribute("count"); -try{ -if(count1==0) -{ -count1=count-1; - -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("select answer from quizques where quizname='"+name+"' and qid='"+count1+"' "); -ResultSet rs=ps.executeQuery(); -if(rs.next()){ -String ans1=rs.getString(1); -System.out.println("ans1 on c10="+ans1); -System.out.println("ans on get1="+ans); -if(ans1.equals(ans)){ -total=total+1; -System.out.println("total="+total); -} - -} - -con.close(); -} - - - -else{ -count1=count-2; -System.out.print("count at get1:"+count); - -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("select answer from quizques where quizname='"+name+"' and qid='"+count1+"' "); -ResultSet rs=ps.executeQuery(); -if(rs.next()){ -String ans1=rs.getString(1); -System.out.println("ans1="+ans1); -System.out.println("ans on get1="+ans); -if(ans1.equals(ans)){ -total=total+1; -System.out.println("total="+total); - -} - -} -con.close(); -} -if(count>(Integer)session.getAttribute("max")) -{ -Integer max=(Integer)session.getAttribute("max"); -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("select answer from quizques where quizname='"+name+"' and qid='"+max+"' "); -ResultSet rs=ps.executeQuery(); -if(rs.next()){ -String ans1=rs.getString(1); -System.out.println("ans1 on c1="+ans1); -String ans2=(String) session.getAttribute("ans"); -System.out.println("ans on get1="+ans2); -if(ans1.equals(ans2)){ -total=total+1; -System.out.println("total="+total); -} - -} - -con.close(); -request.setAttribute("total",total); -total=0; -%> - - -<% - - -} - -}catch(Exception e){e.printStackTrace();} - -} -%> - \ No newline at end of file diff --git a/WebContent/header.jsp b/WebContent/header.jsp deleted file mode 100644 index a0183ef..0000000 --- a/WebContent/header.jsp +++ /dev/null @@ -1,53 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -Online Quiz - - - -
-
- -
- -
- - - - - -
- -
-
-

-

-
- - -
\ No newline at end of file diff --git a/WebContent/home.jsp b/WebContent/home.jsp deleted file mode 100644 index 61c10bf..0000000 --- a/WebContent/home.jsp +++ /dev/null @@ -1,157 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("finished")!=null){ - out.print(""); - out.print(""); - out.print(request.getAttribute("finished")); - out.print(""); - out.print(""); - } - if(request.getAttribute("category")!=null){ - out.print(""); - out.print(request.getAttribute("category")); - out.print(""); - } - - %> -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various subjects -

- Now Teacher and Student can work together
- online.Tutors are most welcomed to my site
- they can create Quiz simply by clicking Make
- Quiz link.And Students can appear in quiz based on various - subject.
-

- - - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - -
-
-
- - diff --git a/WebContent/images/Copy of parrot.png b/WebContent/images/Copy of parrot.png deleted file mode 100644 index 3dc056b..0000000 Binary files a/WebContent/images/Copy of parrot.png and /dev/null differ diff --git a/WebContent/images/Thumbs.db b/WebContent/images/Thumbs.db deleted file mode 100644 index ff868c7..0000000 Binary files a/WebContent/images/Thumbs.db and /dev/null differ diff --git a/WebContent/images/arrow.gif b/WebContent/images/arrow.gif deleted file mode 100644 index aa61925..0000000 Binary files a/WebContent/images/arrow.gif and /dev/null differ diff --git a/WebContent/images/arrow.jpg b/WebContent/images/arrow.jpg deleted file mode 100644 index f96598e..0000000 Binary files a/WebContent/images/arrow.jpg and /dev/null differ diff --git a/WebContent/images/bg.jpg b/WebContent/images/bg.jpg deleted file mode 100644 index 1b41193..0000000 Binary files a/WebContent/images/bg.jpg and /dev/null differ diff --git a/WebContent/images/box_title_bg.gif b/WebContent/images/box_title_bg.gif deleted file mode 100644 index af3923e..0000000 Binary files a/WebContent/images/box_title_bg.gif and /dev/null differ diff --git a/WebContent/images/calendar_bg.gif b/WebContent/images/calendar_bg.gif deleted file mode 100644 index 24c490f..0000000 Binary files a/WebContent/images/calendar_bg.gif and /dev/null differ diff --git a/WebContent/images/calendar_icon.gif b/WebContent/images/calendar_icon.gif deleted file mode 100644 index 2d06c27..0000000 Binary files a/WebContent/images/calendar_icon.gif and /dev/null differ diff --git a/WebContent/images/center_box_bg.gif b/WebContent/images/center_box_bg.gif deleted file mode 100644 index d6e8369..0000000 Binary files a/WebContent/images/center_box_bg.gif and /dev/null differ diff --git a/WebContent/images/clients_icon.gif b/WebContent/images/clients_icon.gif deleted file mode 100644 index 4f17bbe..0000000 Binary files a/WebContent/images/clients_icon.gif and /dev/null differ diff --git a/WebContent/images/contact_icon.gif b/WebContent/images/contact_icon.gif deleted file mode 100644 index bd9a56b..0000000 Binary files a/WebContent/images/contact_icon.gif and /dev/null differ diff --git a/WebContent/images/divider.gif b/WebContent/images/divider.gif deleted file mode 100644 index 3f15cef..0000000 Binary files a/WebContent/images/divider.gif and /dev/null differ diff --git a/WebContent/images/footer_bg.gif b/WebContent/images/footer_bg.gif deleted file mode 100644 index d44ecd7..0000000 Binary files a/WebContent/images/footer_bg.gif and /dev/null differ diff --git a/WebContent/images/link_more_bg.gif b/WebContent/images/link_more_bg.gif deleted file mode 100644 index 29566d8..0000000 Binary files a/WebContent/images/link_more_bg.gif and /dev/null differ diff --git a/WebContent/images/link_more_bg_a.gif b/WebContent/images/link_more_bg_a.gif deleted file mode 100644 index aab4bc5..0000000 Binary files a/WebContent/images/link_more_bg_a.gif and /dev/null differ diff --git a/WebContent/images/logo.gif b/WebContent/images/logo.gif deleted file mode 100644 index f6dcc37..0000000 Binary files a/WebContent/images/logo.gif and /dev/null differ diff --git a/WebContent/images/menu_arrow.gif b/WebContent/images/menu_arrow.gif deleted file mode 100644 index 5e11070..0000000 Binary files a/WebContent/images/menu_arrow.gif and /dev/null differ diff --git a/WebContent/images/menu_bg.gif b/WebContent/images/menu_bg.gif deleted file mode 100644 index 2e79d17..0000000 Binary files a/WebContent/images/menu_bg.gif and /dev/null differ diff --git a/WebContent/images/online quiz.jpg b/WebContent/images/online quiz.jpg deleted file mode 100644 index eb666ff..0000000 Binary files a/WebContent/images/online quiz.jpg and /dev/null differ diff --git a/WebContent/images/online_quiz.gif b/WebContent/images/online_quiz.gif deleted file mode 100644 index 786e319..0000000 Binary files a/WebContent/images/online_quiz.gif and /dev/null differ diff --git a/WebContent/images/p1.gif b/WebContent/images/p1.gif deleted file mode 100644 index 729b8b5..0000000 Binary files a/WebContent/images/p1.gif and /dev/null differ diff --git a/WebContent/images/p2.gif b/WebContent/images/p2.gif deleted file mode 100644 index 9b84330..0000000 Binary files a/WebContent/images/p2.gif and /dev/null differ diff --git a/WebContent/images/parrot.png b/WebContent/images/parrot.png deleted file mode 100644 index 84bc68c..0000000 Binary files a/WebContent/images/parrot.png and /dev/null differ diff --git a/WebContent/images/top_bg.jpg b/WebContent/images/top_bg.jpg deleted file mode 100644 index c79c8ce..0000000 Binary files a/WebContent/images/top_bg.jpg and /dev/null differ diff --git a/WebContent/images/top_box.gif b/WebContent/images/top_box.gif deleted file mode 100644 index 093ae80..0000000 Binary files a/WebContent/images/top_box.gif and /dev/null differ diff --git a/WebContent/index.jsp b/WebContent/index.jsp deleted file mode 100644 index 51dc14d..0000000 --- a/WebContent/index.jsp +++ /dev/null @@ -1,183 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -Login Form - - - - -
-
- -
-
- - - - - - -
- -
-
-

- -

-
- - -
- - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - - - %> -
- -
- -

Welcome to my Site

- -
- - - - - - - - -
Login Form
Category: -
User Name:
Password:
Register
-
- - - -
-
- -
-

Latest News

-
-
23
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
23
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - -
-
-
- \ No newline at end of file diff --git a/WebContent/loginprocess.jsp b/WebContent/loginprocess.jsp deleted file mode 100644 index 7900622..0000000 --- a/WebContent/loginprocess.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="org.omg.CORBA.PUBLIC_MEMBER"%> -<%@page import="java.sql.*"%> -<%@page import="java.util.*"%> -<% -String username=request.getParameter("username"); -System.out.print(username); -String userpass=request.getParameter("userpass"); -String category=request.getParameter("category"); - -boolean status=false; -try{ -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("select * from quizregister where username=? and userpass=? "); -ps.setString(1,username); -ps.setString(2,userpass); -ResultSet rs=ps.executeQuery(); -status=rs.next(); -if(status){ -System.out.print("hi"); -username=rs.getString(1); -session.setAttribute("username",String.valueOf(username)); -session.setAttribute("islogin","plz sign in first"); -session.setAttribute("category",category); -%> - -<% -} -else{ -System.out.print("hi"); -request.setAttribute("Error","Sorry! Username or Password Error. plz Enter Correct Detail or Register"); -session.setAttribute("Loginmsg","plz sign in first"); -%> - -<% -} -} - -catch(Exception e){ -e.printStackTrace(); -} - -%> - - diff --git a/WebContent/logout.jsp b/WebContent/logout.jsp deleted file mode 100644 index ca5c39c..0000000 --- a/WebContent/logout.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - - - - - -----//body tags -<% - -session.invalidate(); -response.setHeader("Cache-Control","no-store"); -response.setHeader("Pragma","no-cache"); -response.setDateHeader ("Expires", 0); - - - - -%> - \ No newline at end of file diff --git a/WebContent/makequiz.jsp b/WebContent/makequiz.jsp deleted file mode 100644 index c52773b..0000000 --- a/WebContent/makequiz.jsp +++ /dev/null @@ -1,149 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - if(session.getAttribute("category")!=null){ - String category=(String)session.getAttribute("category"); - if(category.equals("Student")){ - request.setAttribute("category","You are not a Teacher,You can't make Quiz"); - %> - - <% - } - - } - - - %> -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various subjects - -
- - - - -
Subject:
-
- - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uoloaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - - \ No newline at end of file diff --git a/WebContent/quizcontact.jsp b/WebContent/quizcontact.jsp deleted file mode 100644 index 80218ea..0000000 --- a/WebContent/quizcontact.jsp +++ /dev/null @@ -1,30 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> - - -<% - - try { - -String name= request.getParameter("name"); -String email= request.getParameter("email"); -String phone= request.getParameter("phone"); -String message= request.getParameter("message"); - -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); - -PreparedStatement ps=con.prepareStatement("insert into quizcontact values(?,?,?,?)"); -ps.setString(1,name); -ps.setString(2,email); -ps.setString(3,phone); -ps.setString(4,message); - -int s= ps.executeUpdate(); - - -} -catch(Exception e){e.printStackTrace();} - -%> - diff --git a/WebContent/register.jsp b/WebContent/register.jsp deleted file mode 100644 index d5a322a..0000000 --- a/WebContent/register.jsp +++ /dev/null @@ -1,197 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - -Registration Form - - - - -
-
- -
-
- - - - - -
-
-
-

-

-
- - -
- - -
- -
- -
- -

Welcome to my Site

-

-
- - - - - - - - - - - -
Registration
User Name:
Password:
Category: -
Email:
-
- - -

-
-
- -
-

Latest News

-
-
23
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
23
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - -
-
-
- \ No newline at end of file diff --git a/WebContent/registerprocess.jsp b/WebContent/registerprocess.jsp deleted file mode 100644 index 4901db9..0000000 --- a/WebContent/registerprocess.jsp +++ /dev/null @@ -1,23 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> -<%try{ - -String username=request.getParameter("username"); -String userpass=request.getParameter("userpass"); -String category=request.getParameter("category"); -String email=request.getParameter("email"); -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -PreparedStatement ps=con.prepareStatement("insert into quizregister values(?,?,?,?)"); - -ps.setString(1,username); -ps.setString(2,userpass); -ps.setString(3,category); -ps.setString(4,email); -int s=ps.executeUpdate(); -System.out.print(s); -}catch(SQLException e2){ -e2.printStackTrace(); -} -%> - diff --git a/WebContent/result.jsp b/WebContent/result.jsp deleted file mode 100644 index 6501521..0000000 --- a/WebContent/result.jsp +++ /dev/null @@ -1,151 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("finished")!=null){ - out.print(""); - out.print(""); - out.print(request.getAttribute("finished")); - out.print(""); - out.print(""); - } - - %> -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various subjects -
-

- Your <%=request.getAttribute("total") %> questions are correct
- -

-
- - - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - diff --git a/WebContent/saveques.jsp b/WebContent/saveques.jsp deleted file mode 100644 index e736f57..0000000 --- a/WebContent/saveques.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> - -<%! static int counter=0; %> -<% -counter++; - try { -Class.forName("oracle.jdbc.driver.OracleDriver"); -Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); -String question= request.getParameter("question"); -String option1= request.getParameter("option1"); -String option2= request.getParameter("option2"); -String option3= request.getParameter("option3"); -String option4= request.getParameter("option4"); -String answer=request.getParameter("answer"); -String description=request.getParameter("description"); -PreparedStatement ps1=con.prepareStatement("select max(quizname) from quizinfo"); -ResultSet rs=ps1.executeQuery(); -while(rs.next()){ -String quizname= rs.getString(1); - -//System.out.print(quizname); - -PreparedStatement ps=con.prepareStatement("insert into quizques values(?,?,?,?,?,?,?,?,?)"); - -ps.setString(1,question); -ps.setString(2,option1); -ps.setString(3,option2); -ps.setString(4,option3); -ps.setString(5,option4); -ps.setString(6,answer); -ps.setString(7,quizname); -ps.setString(8,null); -ps.setString(9,description); -int s= ps.executeUpdate(); - - -} - -} -catch(Exception e){e.printStackTrace();} - -%> -<% -request.setAttribute("counter",counter); -%> - diff --git a/WebContent/start.jsp b/WebContent/start.jsp deleted file mode 100644 index 879f9fd..0000000 --- a/WebContent/start.jsp +++ /dev/null @@ -1,234 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("finished")!=null){ - out.print(""); - out.print(""); - out.print(request.getAttribute("finished")); - out.print(""); - out.print(""); - } - %> - -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various sunject - -
- - - - - - - -
- <% - String question=(String)session.getAttribute("question"); - String option1= (String)session.getAttribute("option1"); - String option2= (String)session.getAttribute("option2"); - String option3= (String)session.getAttribute("option3"); - String option4= (String)session.getAttribute("option4"); - out.print(question); - %> - <% - if((String)request.getParameter("radio")!=null){ - String ans=(String)request.getParameter("radio"); - System.out.println("ans on set"+ans); - session.setAttribute("ans",ans); - - } %> -
<%=option1%>
<%=option2 %>
<%=option3 %>
<%=option4 %>
-
- - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - diff --git a/WebContent/style.css b/WebContent/style.css deleted file mode 100644 index e973ec6..0000000 --- a/WebContent/style.css +++ /dev/null @@ -1,294 +0,0 @@ -body -{ -background:url(images/bg.jpg) repeat-x top #fff; -padding:0; -font-family:Verdana, Arial, Helvetica, sans-serif; -font-size:10px; -margin:0px auto auto auto; -color:#416271; -} -p{ -text-align:justify; -line-height:14px; -margin:0px; -} -span{ -color:#7cb805; -} -a{ -text-decoration:none; -color:#416271; -} -h1{ -width:225px; -margin:0 0 5px 0; -font-family:Arial, Helvetica, sans-serif; -font-size:12px; -color:#8c847a; -padding:5px 0 3px 0; -border-bottom:1px #CCCCCC dashed; -} -#main_container{ -width:900px; -height:auto; -margin:auto; -padding:0px; -position:relative; -background:url(images/top_bg.jpg) no-repeat left top; -} -.main_content{ -width:700px; -height:auto; -margin:auto; -} -.parrot{ -position:absolute; -top:0px; -left:45px; -} -#header{ -width:700px; -height:135px; -margin:auto; -} -.logo{ -padding:55px 0 0 115px; -} -.top_center_box{ -width:700px; -height:19px; -background:url(images/top_box.gif) no-repeat center; -} -.center_box{ -width:700px; -background-color:#FFFFFF; -} -/*---------------- menu tab----------------------*/ -#menu_tab{ -width:700px; -height:51px; -font-family:Arial, Helvetica, sans-serif; -padding:0px; -margin:auto; -background:url(images/menu_bg.gif) no-repeat center; -} - -ul.menu { -list-style-type:none; display:block; width:560px; -margin: auto; padding:0px; background:none;} - -ul.menu li { -display:inline; -font-size:13px; -font-weight:bold; -line-height:51px;} - -ul.menu li.divider { -display:block; -float:left; -width:1px; -height:51px; -padding:0px ; -margin:0px; -background:url(images/divider.gif) no-repeat center; -} - -a.nav:link, a.nav:visited { -display:block; float:left; padding:0px; margin:0;width: auto; margin:0px 14px 0px 14px; text-align:center; -text-decoration:none; background:none; color:#62584d;} - -a.nav_selected:link, a.nav_selected:visited { -display:block; float:left; padding:0px; margin:0;width: auto;margin:0px 14px 0px 14px;text-align:center; -text-decoration:none; color: #62584d; background:url(images/menu_arrow.gif) no-repeat top center;} - -a.nav:hover { -color: #62584d; text-decoration:none;background:url(images/menu_arrow.gif) no-repeat top center;} - -/*---------------middle_box-----------------*/ -.middle_box{ -width:654px; -height:161px; -background:url(images/center_box_bg.gif) no-repeat center; -margin:10px auto; -} -.middle_box_text_content{ -width:335px; -height:auto; -} -.middle_box_title{ -width:260px; -height:63px; -padding:5px; - -} -p.middle_text{ -padding:0 0 0 15px; -} -/*----------------left_content------------*/ -.left_content{ -width:345px; -float:left; -padding:10px; -} -.calendar_box{ -width:329px; - -background:url(images/calendar_bg.gif) no-repeat center; -} -.calendar_box2{ -width:329px; -} -.calendar_box_content{ -width:260px; -padding-left:53px; -} -.calendar_box_content1{ -width:260px; -padding-left:40px; -height:230px; -} -.calendar_box_content2{ -width:260px; -padding-left:40px; -height:400px; -} -.right_content{ -width:310px; -float:left; -padding:10px 0 0 0; -} -.news_left{ -padding:10px 0 0 10px; -} -.project_box{ -clear:both; -padding:10px 0 15px 0; -} -.project_box_portofolio{ -float:left; -padding:10px 15px 15px 15px; -} -img.left_img{ -float:left; -padding:0 15px 0 0; -} -.news_box{ -padding:5px 0 5px 0; -} -.calendar{ -width:42px; -height:47px; -float:left; -background:url(images/calendar_icon.gif) no-repeat center; -text-align:center; -line-height:47px; -font-size:14px; -font-weight:bold; -color:#5d2c1a; -} -.news_content{ -width:270px; -float:left; -padding:0 0 0 10px; -} -a.read_more{ -width:75px; -height:29px; -display:block; -float:right; -margin:5px; -background:url(images/link_more_bg.gif) no-repeat center; -text-decoration:none; -color:#6c331f; -text-align:center; -line-height:29px; -} -a.read_more_a{ -width:75px; -height:29px; -display:block; -float:right; -margin:5px; -background:url(images/link_more_bg_a.gif) no-repeat center; -text-decoration:none; -color:#dcc1b7; -text-align:center; -line-height:29px; -} -.wide_content{ -width:660px; -clear:both; -padding:0 20px 0 20px; -} -.projects_navigation{ -padding-right:250px; -} -p.contact_info{ -padding:10px 0 0 20px; -line-height:18px; -} -span.orange{ -color:#f89824; -} -/*-----------------------contact_form-------------------*/ -#contact_form{ -width:300px; -height:auto; -padding:10px 0 0 20px; -} -.form_row{ -float:left; -padding:8px 0 8px 0; -} -label{ -width:55px; -float:left; -padding:3px 5px 0 0; -color:#8ebb41; -text-align:right; -} -input.contact_input{ -width:225px; -height:18px; -float:left; -border:1px #d1e0ee solid; -background-color:#eef4d7; -color: #000; -} -textarea.contact_textarea{ -width:225px; -height:80px; -float:left; -border:1px #d1e0ee solid; -background-color:#eef4d7; -color: #000; -} -/*----------------------services-------------------------*/ -.services{ -float:left; -} -.services ul{ -list-style:none; -padding:15px 10px 5px 0; -margin:0px; -} -.services ul li{ -padding:5px; -} -.services ul li a{ -background:url(images/arrow.gif) no-repeat left; -padding:0 0 0 25px; -text-decoration:none; -color:#416271; -} - - -/*--------------------footer--------------------*/ -#footer{ -width:680px; -height:16px; -clear:both; -color:#763c26; -padding:30px 0 0 20px; -background:url(images/footer_bg.gif) no-repeat center; -} diff --git a/WebContent/takequiz.jsp b/WebContent/takequiz.jsp deleted file mode 100644 index 14ba095..0000000 --- a/WebContent/takequiz.jsp +++ /dev/null @@ -1,207 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - - - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("finished")!=null){ - out.print(""); - out.print(""); - out.print(request.getAttribute("finished")); - out.print(""); - out.print(""); - } - - %> -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various subjects - -
- - Enter the subject: -
-
- - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - diff --git a/WebContent/test.jsp b/WebContent/test.jsp deleted file mode 100644 index 39bf2e2..0000000 --- a/WebContent/test.jsp +++ /dev/null @@ -1,5 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> - - - - \ No newline at end of file diff --git a/WebContent/view.jsp b/WebContent/view.jsp deleted file mode 100644 index e6618af..0000000 --- a/WebContent/view.jsp +++ /dev/null @@ -1,163 +0,0 @@ -<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%> -<%@page import="java.sql.*"%> - - - - - -<% -String islogin=(String)session.getAttribute("islogin"); -if(islogin==null){ -request.setAttribute("notlogin_msg","Sorry,Please do Login first"); - -%> - -<% -} -%> - - - -
- <% - if(request.getAttribute("notlogin_msg")!=null){ - out.print(""); - out.print(request.getAttribute("notlogin_msg")); - out.print(""); - } - %> - <% - if(request.getAttribute("Error")!=null){ - out.print(""); - out.print(request.getAttribute("Error")); - out.print(""); - } - %> - <% - if(request.getAttribute("finished")!=null){ - out.print(""); - out.print(""); - out.print(request.getAttribute("finished")); - out.print(""); - out.print(""); - } - - %> -
- -
- -

Welcome to my Site

- Assess Yourself by taking quizs on various subjects - <% - String name=(String)session.getAttribute("quizname"); - try{ - Class.forName("oracle.jdbc.driver.OracleDriver"); - Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); - PreparedStatement ps= con.prepareStatement("select * from quizques where quizname='"+name+"'"); - ResultSet rs=ps.executeQuery(); - out.print(""); - while(rs.next()){ - out.print(""); - out.print(""); - out.print(""); - - } - out.print("
Question:"+rs.getString(1)+"
Answer:"+rs.getString(6)+"
Description:"+rs.getString(9)+"
"); - - }catch(Exception e){e.printStackTrace();} - %> - - - -
-
- -
-

Latest News

-
-
1
-
-

- now learn how to develop android application free of cost


- read more -
-
-
-
-
2
-
-

- we have latest projects uploaded on my site

- read more -
-
- - - - -
- - -
- - - -
- - -

Latest Projects

- -
- -

- Description:
- Payment billing System - Online Quiz
- Matrimonial - -

-
- -
- -

- Description:
- - Gmail Account
- Latest Quiz -

-
-
-
- -


Our main Services

-
- - - - - -
- - - - - - - - - - diff --git a/build/classes/com/javatpoint/MyListener.class b/build/classes/com/javatpoint/MyListener.class deleted file mode 100644 index 769fb3d..0000000 Binary files a/build/classes/com/javatpoint/MyListener.class and /dev/null differ diff --git a/module1/pom.xml b/module1/pom.xml new file mode 100644 index 0000000..137019b --- /dev/null +++ b/module1/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.sonarqube + sonarscanner-maven-aggregate + 1.0-SNAPSHOT + + + module1 + + Module 1 + + + ${basedir}/../${aggregate.report.dir} + + + + diff --git a/module1/src/main/java/com/acme/module1/Module1.java b/module1/src/main/java/com/acme/module1/Module1.java new file mode 100644 index 0000000..906c68f --- /dev/null +++ b/module1/src/main/java/com/acme/module1/Module1.java @@ -0,0 +1,17 @@ +package com.acme.module1; + +public class Module1 { + + public void coveredByUnitTest() { + System.out.println("This method is covered by unit test"); + } + + public void coveredByIntegrationTest() { + System.out.println("This method is covered by integration test"); + } + + public void uncovered() { + System.out.println("This method is not covered"); + } + +} diff --git a/module1/src/test/java/com/acme/module1/Module1Test.java b/module1/src/test/java/com/acme/module1/Module1Test.java new file mode 100644 index 0000000..b840561 --- /dev/null +++ b/module1/src/test/java/com/acme/module1/Module1Test.java @@ -0,0 +1,12 @@ +package com.acme.module1; + +import org.junit.Test; + +public class Module1Test { + + @Test + public void coveredByUnitTest() { + Module1 module1 = new Module1(); + module1.coveredByUnitTest(); + } +} diff --git a/module2/pom.xml b/module2/pom.xml new file mode 100644 index 0000000..b419ec2 --- /dev/null +++ b/module2/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + org.sonarqube + sonarscanner-maven-aggregate + 1.0-SNAPSHOT + + + module2 + + Module 2 + + + ${basedir}/../${aggregate.report.dir} + + + + diff --git a/module2/src/main/java/com/acme/module2/Module2.java b/module2/src/main/java/com/acme/module2/Module2.java new file mode 100644 index 0000000..8113f3f --- /dev/null +++ b/module2/src/main/java/com/acme/module2/Module2.java @@ -0,0 +1,16 @@ +package com.acme.module2; + +public class Module2 { + + public void coveredByUnitTest() { + System.out.println("This method is covered by unit test"); + } + + public void coveredByIntegrationTest() { + System.out.println("This method is covered by integration test"); + } + + public void uncovered() { + System.out.println("This method is not covered"); + } +} diff --git a/module2/src/test/java/com/acme/module2/Module2Test.java b/module2/src/test/java/com/acme/module2/Module2Test.java new file mode 100644 index 0000000..2fa2008 --- /dev/null +++ b/module2/src/test/java/com/acme/module2/Module2Test.java @@ -0,0 +1,11 @@ +package com.acme.module2; + +import org.junit.Test; + +public class Module2Test { + + @Test + public void coveredByUnitTest() { + new Module2().coveredByUnitTest(); + } +} diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7f25e5d --- /dev/null +++ b/pom.xml @@ -0,0 +1,87 @@ + + + 4.0.0 + + org.sonarqube + sonarscanner-maven-aggregate + 1.0-SNAPSHOT + pom + + Example of multi-module Maven project + + + module1 + module2 + tests + + + + UTF-8 + UTF-8 + 1.8 + 1.8 + tests/target/site/jacoco-aggregate/jacoco.xml + + + + + com.google.guava + guava + 27.1-jre + + + junit + junit + 4.13.1 + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + + org.sonarsource.scanner.maven + sonar-maven-plugin + 3.7.0.1746 + + + org.jacoco + jacoco-maven-plugin + 0.8.6 + + + + + + + + coverage + + true + + + + + org.jacoco + jacoco-maven-plugin + + + prepare-agent + + prepare-agent + + + + + + + + + diff --git a/src/com/javatpoint/MyListener.java b/src/com/javatpoint/MyListener.java deleted file mode 100644 index d5078c9..0000000 --- a/src/com/javatpoint/MyListener.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.javatpoint; -import javax.servlet.*; -import java.sql.*; - -public class MyListener implements ServletContextListener{ - - public void contextInitialized(ServletContextEvent arg0) { - - Connection con=null; - try{ - ResultSet rs; - Class.forName("oracle.jdbc.driver.OracleDriver"); - con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","oracle"); - - PreparedStatement ps1=con.prepareStatement("Select * from QUIZCONTACT"); - - rs=ps1.executeQuery(); - if(rs.next()) - {System.out.println("your table name already exist");} - else - {System.out.println("else if part table does not exist new table has created"); - - - PreparedStatement ps2= con.prepareStatement("CREATE SEQUENCE JAVATPOINT MINVALUE 1 MAXVALUE 999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE"); - ps2.executeUpdate(); - PreparedStatement ps=con.prepareStatement("CREATE TABLE QUIZCONTACT (NAME VARCHAR2(4000),EMAIL VARCHAR2(4000),PHONE VARCHAR2(4000),MESSAGE VARCHAR2(4000))"); - ps.executeUpdate(); - PreparedStatement ps4=con.prepareStatement("CREATE TABLE QUIZINFO (SUBJECT VARCHAR2(4000),QUIZNAME VARCHAR2(4000))"); - ps4.executeUpdate(); - - - PreparedStatement ps5=con.prepareStatement("CREATE TABLE QUIZQ(NAME VARCHAR2(4000),EMAIL VARCHAR2(4000),PHONE VARCHAR2(4000),QUESTION VARCHAR2(4000))"); - ps5.executeUpdate(); - - - ps5= con.prepareStatement("CREATE TABLE QUIZQUES(QUESTION VARCHAR2(4000),OPTION1 VARCHAR2(4000),OPTION2 VARCHAR2(4000),OPTION3 VARCHAR2(4000),OPTION4 VARCHAR2(4000),ANSWER VARCHAR2(4000),QUIZNAME VARCHAR2(4000),QID VARCHAR2(4000),DESCRIPTION VARCHAR2(4000),CONSTRAINT QUIZQUES_PK PRIMARY KEY (QID) ENABLE)"); - ps5.executeUpdate(); - - - ps5= con.prepareStatement("CREATE TABLE QUIZREGISTER (USERNAME VARCHAR2(4000),USERPASS VARCHAR2(4000),CATEGORY VARCHAR2(4000),EMAIL VARCHAR2(4000))"); - ps5.executeUpdate(); - Statement stmt=con.createStatement(); - stmt.executeUpdate("CREATE TRIGGER BI_QUIZINFO before insert on QUIZINFO for each row begin select JAVATPOINT.nextval into :NEW.QUIZNAME from dual;end"); - stmt.executeUpdate("CREATE TRIGGER BI_QUIZQUES before insert on QUIZQUES for each row begin select JAVATPOINT.nextval into :NEW.QID from dual;end"); - } - } - - catch(Exception e){ - e.printStackTrace(); - - } - } - - public void contextDestroyed(ServletContextEvent arg0) { - System.out.println("project undeployed"); - - } -} diff --git a/tests/pom.xml b/tests/pom.xml new file mode 100644 index 0000000..728dcf8 --- /dev/null +++ b/tests/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + + + org.sonarqube + sonarscanner-maven-aggregate + 1.0-SNAPSHOT + + + tests + + + ${basedir}/../${aggregate.report.dir} + + + Tests + + + + org.sonarqube + module1 + 1.0-SNAPSHOT + + + org.sonarqube + module2 + 1.0-SNAPSHOT + + + + + + + org.jacoco + jacoco-maven-plugin + + + report + + report-aggregate + + verify + + + + + + + diff --git a/tests/src/test/java/com/acme/its/ModulesTest.java b/tests/src/test/java/com/acme/its/ModulesTest.java new file mode 100644 index 0000000..5c12a20 --- /dev/null +++ b/tests/src/test/java/com/acme/its/ModulesTest.java @@ -0,0 +1,19 @@ +package com.acme.its; + +import com.acme.module1.Module1; +import com.acme.module2.Module2; +import org.junit.Test; + +public class ModulesTest { + + @Test + public void integrationTest1() { + new Module1().coveredByIntegrationTest(); + } + + @Test + public void integrationTest2() { + new Module2().coveredByIntegrationTest(); + } + +}