I am making some Junit Tests that process some files with a parser and the do some other processes. I already have a loop for processing a whole folder at a time. But I want to know how can I do so that for each file it processes I can generate an individual report.
I have made a basic math game that asks you questions and tells you if you have answered them correctly or incorrectly. The game runs great! The thing is that it asks you a question one time and after you answer you have to run the program again. I want to get the program to ask ten questions. After that I want to figure out a scoring system for it but the first step is to get it to ask my ten questions. Here is my code.
package pkgnew; import java.util.Scanner; import java.util.Random; public class New { public static void main(String args[]) {
I have a problem in generating reports using java code. I created a report using iReport 5.5.0 with MySql Database connection. In iReports, it shows the correct output while previewing it. Then i copied my .jrxml file and pasted it into my netbeans project folder(..sample/web/WEB-INF/sample.jrxml) and then i added the required jar files in my project's library folder. i am generating the report in netbeans using jsp and servlet. THE REPORT IS GENERATING AND SAVED SUCCESSFULLY IN MY DESKTOP. BUT IT DOESN'T GENERATE THE REPORT FOR FIRST RESULT. For Example.., if i generating report based on a particular date. After executing the query, it returns 4 results. So it has to create the reports in 4 pages. But it generates the report for last 3 pages only. It doesn't generate the report for first page. I have attached my .jrxml file servlet file for your reference.
I've been working on a lesson in logging in Java, formatting in XML. I'm trying to add an appender to e-mail the error log, but can't seem to get it to work. Is there a piece I'm missing? The rest of my appenders are working fine. The error I get is that it cannot create an appender of this type. The console also seems to think that I defined the appender after I call for it, but it is above. Here is what I put together:
I inherited a web application and am trying to build it. I recently installed JasperSoft Studio 5.5.0 final on my developer machine. I also have Eclipse Juno on my developer machine. I was advised by the previous developer to put some of his Jasper .jar files into my web app's lib folder. I did do this and now the localhost will not run, it is generating this error:
The version on them would appear incorrect given my version of 5.5. I am new to Jasper Reports. I suppose I could google on the .jar files and get the ones that belong to the 5.5.0 final and put them into the directory to see if Apache Tomcat 6.0.39 likes that better. And then start the server. If it doesn't like them, I guess I could remove them and continue, but I would prefer to have the Jasper Reports up and running.
My second question about the Jasper Reports is how do you tell the IDE where the Reports are located?
this is a syntax error within Jasper reports in the printwhenexpression property.I can use the following expression successfully: new Boolean ($F{off_peak_free_minutes}. trim().equals("")==false) - this basically tells Jasper Reports to ignore the column unless it has a value.
Now I'm trying to do the same thing with ZERO but I can't get the syntax right. I've tried: new Boolean($F{off_peak_free_minutes} != 0) but the ZERO comes up with a red underline implying that this is illegal.I've also tried: new Boolean($F{friends_family_minutes}!=Double.valueOf(0)) but the ZERO comes up with the red underline.
I suspect I'm just not specifying the JAVA right. I believe that the $F{friends_family_minutes} variable is a DOUBLE - it prints as 0.00 on the report.
For one of my project, required to capture the audit history reports of all the activities of the users within the application. We are using Servlet/JSP in J2EE environment.
For Ex: Whenever user updates some fields, we need to capture the Old value, new value, user id and time stamp. We have single form with more than 200 fields.
Just want to know the best way to do this..any frameworks available for it...or doing at the database side like using triggers..
I have been designing a music collection application that runs from a database. I now need to develop a junit test to test the application but I am not sure if Junit has anything to work with testing databases. I have been googling on the internet but most of the search results do not really give any good examples that I can easily follow and adapt to my application. I am using only one table and I would like to test INSERT, UPDATE and DELETE actions and I would also like to test a successful connection.
I once found one tutorial which I cannot find any more that had something that retrieves all the data in the database and stores it in a CSV file and the loops through the CSV file to check or update information.
How do you test the events within an inner class using JUnit
// File: : events/SomePanel.java // Purpose: Show use of named inner class listener.
import javax.swing.*; import java.awt.event.*; class SomePanel extends JPanel { private JButton myGreetingButton = new JButton("Hello"); private JTextField myGreetingField = new JTextField(20);
[Code] .....
Code extract taken from: Java: Inner-class Listeners
Taking the above example, do I need to use myGreetingButton.doClick to trigger this event to test the respective variables/values being used ? Also the Actionlistener inner classes is private so doubt I can access this from JUnit Test class.
i want to use cucumber in java through code. previously i have used it with Junit. but now i need to implement it through coding for the purpose of automating.
Can EJB be developed with a Test Driven Development approach? Is that possible with Junit or should it require other tools/frameworks?I am also interested in understanding which mocks should I consider and which part of the IJB code must instead be tested?
I am working on a class project and I have to write the JUnit test for the GUI class ... what I did wrong ... Here is the code for the GUILauncher:
package edu.oakland.production; import java.awt.*; import javax.swing.*; public class GUILauncher{ public static void main(String[] args){ RetrieveWindow gui = new RetrieveWindow();
First I was using this way how to get connection and all was fine.
con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");
But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.
ClientDataSource ds = new ClientDataSource(); con = ds.getConnection();
I get an error "ArrayIndexOutOfBounds" in my Junit test on the following method:
public String[] getMACs(String ssid) { int first = bs.searchFirst(arrayWlanMac, new GetSet(null, ssid, 0, 0), new ComparatorSSID()); int last = bs.searchLast(arrayWlanSsid, new GetSet(null, ssid, 0, 0),
[Code] ....
The error occurs in the first while loop right in the if condition (if (!arrayWlanSsid[i + 1].getMac().equalsIgnoreCase(arrayWlanSsid[i].getMac())) )
I'm facing a Problem with the JUnit Test for a Fibonacci rabbits sequence. The JUnit Test should test if the function dynFib(int x) completes the calucation in time. The time given is 100ms. The sequence I wanted to be printed is 0 1 1 2 3 4 6 8 11 15 and I got it but the calculation takes more than 100ms. How can I make it calculate faster without using a loop?
I want to do it recursively and dynamically, I kept trying lots of methods but they did not work.
This is my Code:
public class TestFib { private static int dynFib(int x, Integer[] array) { array = new Integer[x + 1]; if (x < 0) { throw new IllegalArgumentException();
I have JUnit exposure only in writing simple programs. Here I have one of the usecases requirement pupose I am generating data file(s) by Java programming and calling this data by Hashmap. My file containing two columns
(1) TimeStamp (2) Speed.
The file is tab formatted file. The business requirement is to check wether the first column should not be 00000000000000 or NULL or BLANK. My question is, how do I check the first field in a file contaning valid information in Junit test case?
I have i am trying to implement tooltip through javascript, like when we click on an image link tooltip should be displayed and it should have close button/ close image to close that tooltip.like the same way i will have multiple images on page, when ever i click on the images all tooltips should be displayed on the page when ever i want to close that then only it should close through close button on tooltip.can we do it through java script or will go for jquery.
I'm very new to Java, and I am creating a program that takes multiple user input to create one face. I have a class for the eyes, nose, lips, and headshape. For some reason, my program is not drawing the graphics. ***for question purposes, I have only included my head shape class and my test class****
my "test" class:
import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class FaceTest { public static void main(String[] args) { String head = JOptionPane.showInputDialog("Would you like a circle, square, rectangle shaped head?: ");
I have wrote this class who read from text line by line and save the words in fileOnTable.. Now i don't know what to read in ReadOffer to save the words in object offers and return this.. One more question.. What JUnit test can write for this code..?
We are making a tic tac toe game for my CS120 class and I am having trouble figuring out how to make our X's and O's. Is there a way to make shapes besides making two lines for an X and an oval with a white smaller oval inside to make an O? We have only learned the basics so far in class (i.e. events, inheritance, client-supplier, etc.)
These are our instructions:
Write a controller that controls the game. There is one human player (the X player) and the computer player (the O player). The name of the class must be TicTacToeController. In a sense, the controller is the game since the controller will 1) create a TicTacToeModel 2) create a TicTacToeView and 3) create a TicTacToeButton (you must write this class following the design pattern covered in class lectures), a label, and text field such that when the button is pushed, the player moves into the cell selected by the text field. After every player move, the computer moves into a randomly selected empty cell. When the game is over, a text message must be displayed somewhere on the screen the gives the status of the game. While you are free to change the appearance of the controller, the basic elements must be provided (a view of the game, a button, and a text field to enter the cell). A sample screenshot is displayed below.And this is the code i have thus far:
[import java.awt.*; import javax.swing.JFrame; public class TicTacToeView extends Rectangle public TicTacToeView(int x, int y, int w, int h) { super(50,60,w,h); this.setBackground(Color.red); JFrame win = new JFrame("Tic Tac Toe"); win.setBounds(10,10,w+100, h+100); win.setLayout(null); win.setVisible(true); win.setBackground(Color.gray);
I have a package (JAR_A) for entity and controller definition, for example:
entity: Entity controller: EntityController
Then I use this jar in other projects/applications that use the entity.
I want to use the same JAR_A with different persistence unit and different database (in particular, mysql and postgresql) but when I define two persistence unit that include the same class, I have an exception.
So, I comment the other PU and compile the project.
there is a smarter way for use same package with different PU ?
I am trying to launch a GUI to my agent-based model (Repast and Eclipse) so that being able to run the model for many times. I am going to produce input parameters based on different distributions for different runs from GUI. Usually we should use batch file for different runs. However, I want to use GUI for this reason because I have GUI that can take care for one run but not for many runs.
I first learned how to program with BYOB. In BYOB there were variables and lists. Variables worked the same as Java and lists were groups of variables. To create a list, I would give it a name. I could then add variables to this list as items throughout the program. Here's an example of what a list would look like:
[[List]] item 1: Hello item 2: world
I could then call upon item 1 or item 2 and delete them if needed. In Java, I want to have 3 lists of variables into which I put user input as variables. The code would look something like the following: (stuff with "//" at the end is detailing what I want to do, not actual working code)
import java.util.*; public class Archives { public static void main(String[] args) { Scanner input = new Scanner(System.in);