How to test a class with array which is being declared?

Dear All
I am doing a question which involved the day of the week.
I had written a class which is name WeekDay and here is the code :
public class WeekDay
private int index;
private static String[]dayStrings = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
public WeekDay(int idx)
index = idx;
public int getIndex()
return index;
public static String nextDay(int index)
index+=1;
return dayStrings[index];
The above compile well with no issue.
Here is the problem which i need to seek your help, I had created a program to test the above program.
But I am not sure how to test it.
Here is what I had written :
public class TestWD
public static void main(String[]args)
System.out.println("Please key in a digit to get the day of the week\n");
System.out.println("Sun, Mon, Tue.....Sat is represented by 0,1,2,3...6");
int idx = Integer.parseInt(args[0]);
WeekDay wd = new WeekDay(dayStrings[]); // I can't seem to declare this line.
My question how can I test the above program ?? I can't seem to be able to declare a "wd" from WeekDay. The dayStrings wich i had declared in the WeekDay class is a String array. But how can I declare a suitable line in my test program in order for me to test my program?
What I wanted to do is to get the above line running and than I will proceed on to code it to display the day after a day...for example, if today is Wednesday and when I run the wd.nextDay(index). It will return me Thursday!
But I am not sure how to declare the above...please enlighten me.
Thank you.

Hi
Thank you for helping but when I compile my program. It seem fine but when I execute it, it prompt me with an error message :
code}public class TestWD
public static void main(String[]args)
System.out.println("Please key in a digit to get the day of the week\n");
System.out.println("Sun, Mon, Tue.....Sat is represented by 0,1,2,3...6");
* int idx = Integer.parseInt(args[0]);*
WeekDay wd = new WeekDay(idx);
System.out.println(wd.nextDay(idx));
}{java.lang.ArrayIndexOutOfBoundsException: 0
     at TestWD.main(TestWD.java:8)
Edited by: SummerCool on Nov 1, 2007 2:53 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How to do like this with array?

    How to do like this with array?
    I have 2 constants array put in main while loop ( array1{6,6}; array2{4,4} ). Those arrays will be come the input data for st in the small while loop inside.
    The input data look like : [6,6],[4,4],[6,6],[4,4]...... I have to put input data to result array[8]. The method is:
    input data result data
    [6,6] --------------------------------------------> [6,6,0,0,0,0,0,0]
    [4,4] --------------------------------------------> [6,6,4,4,0,0,0,0] ( this period, just add each element in new array)
    [6,6] --------------------------------------------> [6,6,4,4,6,6,0,0]
    [4,4] --------------------------------------------> [6,6,4,4,6,6,4,4]
    [6,6,4,4,6,6,4,4] ( 1st period )
    When the las index of result data array is filled in, I have to collapse the result data array to be this array:
    ----------> collapse: [6,4,6,4,0,0,0,0] ( take the average of 2 continuous element add to new result data array)
    Next input data
    [6,6] --------------------------------------------> [6,4,6,4,6,0,0,0]
    [4,4] --------------------------------------------> [6,4,6,4,6,4,0,0] ( this period, add the average of 2 continuous elements in new array )
    [6,6] --------------------------------------------> [6,4,6,4,6,4,6,0]
    [4,4] --------------------------------------------> [6,4,6,4,6,4,6,4]
    [6,4,6,4,6,4,6,4] ( 2 nd period)
    ----------> 2nd collapse [5,5,5,5,0,0,0,0] ( take the average of 2 continous element add to new result data array)
    Next input data
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,0,0,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,0,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,0]
    [6,6] ....wait until input data has 4 elements
    [4,4] -------------------------------------------------------------------------------------> [5,5,5,5,5,5,5,5]
    [5,5,5,5,5,5,5,5] ( third period )
    ----------> 3rd collapse [5,5,5,5,0,0,0,0]
    This wayl to make the tren graph.I  made  an VI to do that , but it's not yet correct.
    Attachments:
    tryyyyyyy.vi ‏39 KB
    trend_mode.JPG ‏49 KB

    Frankly, I don't understand your problem description or your VI.
    In the description, the output array has a fixed size of 8 elements, is this correct? In this case you should initialize an array of 8 elements and do all operations "in place". I don't udnerstand the purpose of all the other code.
    There are a lof of things that don't make any sense at all.
    The second largest loop has no purpose, because it iterates only once per call
    Sometimes you are concatenating an empty array to an existing array. This makes no difference.
    Why is some of your data EXT representation???
    What's up with complicated constructs such as that small loop shown in the picture. I show a somewhat simpler alternative.
    Anyway, I have a hard time understanding your description. What should happen at the end? Do you have a link to a website that describes the algorithm? Does the algorithm have a name?
    Message Edited by altenbach on 01-10-2008 09:55 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    Simplify.png ‏5 KB

  • How to use TableSorter class with DefaultTableModel

    Hi Friends
    Please tell me how to use TableSorter Class which is in the Java. Tutorials with DefaultTableModel.
    i saw in a thread there it was given that we have to pass the DefaultTableModel to the TableSorter Class.
    I tried to use like that. But i am getting Error Like Exception occurred during event dispatching:
    I am posting the part of Code where i use the DefaultTableModel
         private void displayavailablity(String selectedAuthor)
                   try
                        Vector columnNames = new Vector();
                        Vector data1 = new Vector();
                        String bname,bauthor,bcategory,bref1,bavail,bid;
                        int bref,mid,num;
                        rs = st.executeQuery("SELECT BId,BName,BAuthorName,BAuthorandPublisher,BCat FROM Books where BAuthorandPublisher='" +selectedAuthor+"'");     
                        ResultSetMetaData md= rs.getMetaData();
                        int columns =md.getColumnCount();
                        String booktblheading[]={"NUMBER","BOOK NAME","AUTHOR","CODE","CATEGORY"};
                        for(int i=1; i<= booktblheading.length;i++)
                             columnNames.addElement(booktblheading[i-1]);
                        while(rs.next())
                             Vector row = new Vector(columns);
                             for(int i=1;i<=columns;i++)
                                  row.addElement(rs.getObject(i));
                             data1.addElement(row);
                             //System.out.println("data is:"+data);
                        ((DefaultTableModel)table.getModel()).setDataVector(data1,columnNames);
                        TableSorter sorter = new TableSorter((DefaultTableModel)table.getModel());
                        rs.close();
                   catch(SQLException ex)
                        System.out.println("ERROR IS HERE");
                        ex.printStackTrace();
         }Please help me on this issue Otherwise Please give me some Sample coding to implement this sorting. with DefaultTableModel
    Thank you for your service
    Cheers
    Jofin

    I don't know about any TableSorter class, but I suppose you mean javax.swing.table.TableRowSorter.
    The TableRowSorter is to be attached to the JTable, not to the data model. Here's a cut'n'paste from the last time I used it:
    RowSorter<TableModel> sorter = new TableRowSorter<TableModel>(tableModel);
    myTable.setRowSorter(sorter);
    And heres from the JDK1.6 documentation:
    TableModel myModel = createMyTableModel();
    JTable table = new JTable(myModel);
    table.setRowSorter(new TableRowSorter(myModel));
    Check out http://java.sun.com/javase/6/docs/api/javax/swing/table/TableRowSorter.html. I find it to be good documentation.

  • How to Test, Inbound idoc ,with out the Sender System, using a Text File

    Hi Guru's .
    we wanted to test BLAORD03 inbound idoc (Message Type BLAORD).with out the SENDER SYSTEM.
    on the same client.
    we wanted to test this idoc with text file from our local machine.
    Can anyone give us detail steps.like how to create  File layout
    with Segment name,and values for the fields.how to pass this file to the system.
    Thanks in advance.

    Hi Aparna.
    My requirement is to test the idoc with Inbound File.
    Generate a file with the data entered through segments through we19 ,and use the same file for processing through we16.
    when i am trying to do this syst complaing about
    Partner Profile not available, and some times
    port not available. and some  times with
    'No further processing defined'.
    but i maintained part profiles and port perfectly.
    Can you help me in testing with test 'File' port.

  • Testing ActionScript classes with native methods?

    Hi,
    I have an ActionScript class that I'm writing and would like to test using FlexUnit.
    The only issue is that the ActionScript class has a member in it that is a class with native methods.
    So, I get the following error when trying to run a test of that ActionScript class:
    VerifyError: Error #1079: Native methods are not allowed in loaded code.
    Does anyone know of a way to get around this?  FlexUnit seems not to like native methods being present.
    Thanks,
    Matt

    Hi casdvm,
    by definition, you only own objects that you created using one of the alloc* methods, copy: or new:. All other objects (IIRC with a few noted exceptions) are autoreleased.
    If you create convenience methods in your own class, you should follow the same rule. For example, if you have a class Pet and want to implement the method +petWithName, your code might look something like that:
    + petWithName: (NSString *)name
    return [[[Pet alloc] initWithName: name] autorelease];
    Alex

  • How to test KM configured with a TREX?

    Hi!
    I have configured a TREX for an EP7.0's KM.
    Could you tell me how to test the TREX ability?
    One example is appreciated.
    Thanks a lot!

    First
    Go to System admin-> monitoring -> Knowledge Management  and check TREX monitor. All should be green
    Then you can create an index in  system admin-> System Config-> KM-> index Administration. Search for that in SDN.
    Then create a search iview . for this also search in SDN as these are very straight forward.
    once index is created then you can mointor that also in
    system admin-> monitoring->KM-> Index monitor.
    Raghu

  • How to make a class an array

    Hello, i am very confused as to how to make an array inside a class and use it from another class. For example, when making a "Book of hotties" where i would create entries in a book(objects) of hot women ,with parameters
    name, last name, phone number, and rating, and i am supposed to make a class for the book itself with a Person [ ] blackBook, and also a separete class called Person where i would create each person. How would i go about creating this array and where would i create it? and from that how can i access it in order to perform methods like sorting and checking entries? Tnx in advance.
    Edited by: Secmugen on May 5, 2009 6:19 AM
    Edited by: Secmugen on May 5, 2009 6:20 AM

    You probably need to start here: http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arrays.html
    There is also a Java collection called ArrayList which is suitable for storing and retreiving objects such as BlackBook, Person etc...
    To access elements of an array within a class you would most likely use a public getter method. eg.
    public class BlackBook {
       private ArrayList<Person> persons = new ArrayList<Person>();
      public ArrayList<Person> getPersons() {
         return this.persons;
      public Person getPerson(int index) {
        this.persons.get(index);
    };etc..

  • How I pass a cluster with array of various data type (double, I32, string)

    I have to pass from a VI to a Microsoft Visual C++ DLL, a cluster with some arrays of various data type. The problem is with Double array, that during Visual C debug is incorrect:the dimension is correct passed, but not array data. In the DLL I have inserted the C code genereted by LabVIEW. I tried to pass a cluster of only one array of double, and the results is the same. Then, I tried to pass a cluster with scalar number and the result is correct in only one case. If the double data is the first in the cluster, the result is correct; if the first is another data type, such as integer or boolean, the double data is incorrect during the debug of the DLL.
    This is the code of my DLL:
    // LabViewP
    aram.cpp : Defines the entry point for the DLL application.
    #include "stdafx.h"
    #include "LabViewParam.h"
    #include "extcode.h"
    BOOL APIENTRY DllMain( HANDLE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved
    switch (ul_reason_for_call)
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
    break;
    return TRUE;
    typedef struct {
    long dimSize;
    double elt[1];
    } TD2;
    typedef TD2 **TD2Hdl;
    typedef struct {
    TD2Hdl elt1;
    } TD1;
    // This is an example of an exported variable
    LABVIEWPARAM_API int nLabViewParamPass=0;
    // This is an example of an exported function.
    LABVIEWPARAM_API int LabViewParamPass(TD1 *pparam)
    double parametro;
    int i;
    for (i=0;i<(**(*pparam).elt1).dimSize;i++)
    parametro=(**(*pparam).elt1).elt[i];
    return 42;
    // This is the constructor of a class that has been exp
    orted.
    // see LabViewParam.h for the class definition
    CLabViewParam::CLabViewParam()
    return;
    I use LabVIEW 7.0 and Windows XP.
    Sorry for my english.
    Thanks to every one for your suggestions.
    Filippo

    > I have to pass from a VI to a Microsoft Visual C++ DLL, a cluster with
    > some arrays of various data type. The problem is with Double array,
    > that during Visual C debug is incorrect:the dimension is correct
    > passed, but not array data. In the DLL I have inserted the C code
    > genereted by LabVIEW. I tried to pass a cluster of only one array of
    > double, and the results is the same. Then, I tried to pass a cluster
    > with scalar number and the result is correct in only one case. If the
    > double data is the first in the cluster, the result is correct; if the
    > first is another data type, such as integer or boolean, the double
    > data is incorrect during the debug of the DLL.
    It is hard tell for sure, but you might have alignment problems. The
    key symptom
    is that you can pass a cluster of big and small fine, but
    small big doesn't pass correctly. You might also test this by seeing
    what the size of your struct is. For Boolean and Double, sizeof()
    should return nine bytes no matter what order the array is in. If you
    are getting different sizes, you have two options. You can either order
    them such that the sizes work, or you can build the EXE or a wrapper DLL
    so that the alignment matches LV's native alignment.
    Greg McKaskle

  • How to create a table with directory which is on different machine

    Hi All,
    I have two servers one is db server db1 and another is app server app1
    I will get files from customer into app1 server in the path d:\files\incoming
    I want to create a table with directory (when I create that it will be mapped to db1) which maps to app1\d\files\incoming,
    please let me know how to achieve this,

    NSK2KSN wrote:
    Hi All,
    I have two servers one is db server db1 and another is app server app1
    I will get files from customer into app1 server in the path d:\files\incoming
    I want to create a table with directory (when I create that it will be mapped to db1) which maps to app1\d\files\incoming,
    please let me know how to achieve this,This is nothing to do with SQL or PL/SQL as such.
    The answer lies in the remit of your Windows administrator to create an alias or link that points
    from your db server to your app server.
    Once that is done, you can refer to the directory as if it was a local one situated on the db server, as normal.
    Edited by: Paul Horth on Feb 21, 2013 10:13 AM
    Changed Unix to Windows when I noticed the direction of the slashes.

  • How to populate a table with array loop

    I'm looping an array object and as I loop, I'm calling a function and this function returns 6 items
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">
      <cfdump var="#zz[k].getLine()#"> <p>
    </CFLOOP > 
    The above cfdump will return something like:
    [empty string]
    street name1
    [empty string]
    [empty string]
    city1
    state1
    zip1
    [empty string]
    street name2
    Apartment AA
    [empty string]
    city2
    state2
    zip2
    street name 3
    Margenthaller Hall
    Suite 202
    city2
    state2
    zip2
    etc
    I need to insert these results into my address table while looping.
    When I did the following (see below), each record got repeated 12 times (not sure why)
    <CFLOOP  from="1" to="#ArrayLen(zz)#" index="k">  <cfdump var="#zz[k].getLine()#">
      <cfquery name="test" datasourece="MyDNS">
       INSERT INTO MyAddr (street1,street2,street3,city,state,zip)
       VALUES ('#zz[1].getLine()#', '#zz[2].getLine()#', '#zz[3].getLine()#', '#zz[4].getLine()#','#zz[5].getLine()#', '#zz[6].getLine()#')
    </cfquery>
    </CFLOOP >
    Is there a way? to do insert as I already got the address correctly while looping but not sure how can I use the return result in insert statement.
    Can anyone help?

    For what you seem to be doing here, the loop is unnecessary and causing the multiple inserts since the <cfquery...> is inside the insert, it will be executed for each and every iteration of the loop.
    You COULD put the loop inside the <cfquery...> to build the repeating part of your query I.E. the VALUES clause it seems in your case.  But, unless you would have different sized arrays I would just do what you are doing and explicitly calling each array element.  I.E. the zz[1]...zz[2]...zz[3]...etc. that you have.

  • How to create a grid with arrays and booleans?

    As part of a bigger project, I'm trying to create a sub-VI which will allow me to move a "cursor" in a 3x3 array.
    There should be 2 boolean inputs, one for moving down in the array, and the other for moving to the right. Once the edge of the array has been reached, the "cursor" will start back from the beginning.
    I have a vague idea of a 2 dimensional array with LED's. Once "down" has been pressed, the LED corresponding to (0,0) will turn off, turning (0,1) on. Same goes for the "right" button. When "down" is pressed at (0,2), the LED should turn off, and LED (0,0) should turn on.
    I'm sure it has something to do with initializing arrays, but i can't seem to find the right way to do it.
    Any kind of assistance is much appreciated. Thanks!
    Solved!
    Go to Solution.

    Maybe this will help.
    Oh, I just noticed that I could have done the "Clear True" outside of the inner case structure and some other things too, but oh well - it works.
    Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
    question. Give "Kudos" to replies that help.
    Attachments:
    grid_png.vi ‏14 KB

  • How to manage tcp buffer with array

    I am having trouble parsing data from the tcpread buffer. I can parse the data from the buffer I was just wondering if the following is possible...Is there a way to have each tcp packet that is received be put into an array element instead of having the buffer append the in received data onto itself. It would be much easier for me if the buffer was divided in to packets that way I could just parse each packet instead of having to find each packet then parse each packet individually? I was just wondering if  there was an example or something, or do I need a vi myself to handle this. I noticed that the TCPREAD vi block has 4 options for the buffer...this is not one of them...but perhaps someone has done something like this before? Thanks for any help.

    Unfortunately the project I have has a variable number of connections so it could be one or it could be up to 65535.
    I've been thinking of a server-type example for my blog.
    I've written a web server in LabVIEW before (1995 or so).  Basically you separate the listener from the service functions.
    The listener listens for connections and puts CONN IDs into a pool (queue).  The pool contains all the connections that are active at the moment, along with some sort of status flag.
    A service loop continuously extracts a connection cluster from the pool, handles it according to it's status, and either returns it to the pool, or terminates the connection and  removes it from the pool.
    The idea is that the server is a sort of state machine which runs through all current connections and gives them some attention.
    You could also do it by spawning a number of copies (one for each connection) of a single reentrant VI, but I don't know about the performance of that.  If you truly have a thousand connections at once, then you would have a thousand instances of this VI running in parallel.
    That's a bit daunting to me, but then I've never tried it. Perhaps someone else could comment on that feasibility.  It would seem that the thread-management overhead might be a problem, but I don't know. 
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How to integrate a class with template.java - Java Concurrent Program. 11i

    Hello, I have a java class I got from a vendor. This java class needs to run through as concurrent program. As per metalink note *How To Create a Java Concurrent Program? [ID 827563.1]* it says that, we must require template.java to wrap around the custom class. I have done that in the following java code. However, being a new java guy, I really dont know how to connect these two classes and constructor.
    Any suggestions about how do I make these classes work in order to run from a concurrent program?
    package oracle.apps.fnd.cp.request;
    import oracle.apps.fnd.util.*;
    import oracle.apps.fnd.cp.request.*;
    import java.io.BufferedReader;
    import java.io.IOException;
    import javax.net.ssl.SSLSocketFactory;
    public class cyberBatch implements JavaConcurrentProgram {
        // Optionally provide class constructor without any arguments.
        // If you provide any arguments to the class constructor then while running the program will fail.
        public void runProgram(CpContext pCpContext) {
            ReqCompletion lRC = pCpContext.getReqCompletion();
            String CompletionText = "";
        // This class is to upload files but can be expanded to download files also.
        public class SSLFileTransfer {
            Properties props =
                new Properties(); // stores properties from property file
       * SSLFileTransfer(): constructor
            public SSLFileTransfer() {
       * init(): initialization (load property file)
          * @param propsFile          properties needed for file transfer
            public void init(String propsFile) {
                try {
                    props.load(new BufferedInputStream(new FileInputStream(new File(propsFile))));
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(-1);
       * usage()
            public static void usage() {
                System.out.println("USAGE: java SSLFileTransfer <full path property file name>");
                System.exit(-1);
       * getFactory(): get factory for authentication
          * @throws IOException     if exception occurs
            private SSLSocketFactory getFactory() throws IOException {
                try {
                    SSLContext ctx;
                    KeyManagerFactory kmf;
                    KeyStore ks, ks1;
                    char[] passphrase =
                        props.getProperty("passPhrase").toCharArray();
                    ctx = SSLContext.getInstance("TLS");
                    kmf = KeyManagerFactory.getInstance("SunX509");
                    ks = KeyStore.getInstance("PKCS12", "BC");
                    ks1 = KeyStore.getInstance("JKS");
                    ks.load(new FileInputStream(props.getProperty("key")),
                            passphrase);
                    ks1.load(new FileInputStream(props.getProperty("keyStore")),
                             passphrase);
                    kmf.init(ks, passphrase);
                    TrustManagerFactory tmf =
                        TrustManagerFactory.getInstance("SunX509");
                    tmf.init(ks1);
                    ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
                    return ctx.getSocketFactory();
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new IOException(e.getMessage());
       * getHost(): Get host from property file
            private String getHost() {
                return props.getProperty("host", "localhost");
       * getPort(): Get port from property file
            private int getPort() {
                return Integer.parseInt(props.getProperty("port"));
       * sendRequest(): Send request (file) to the server
          * @param out          stream to send the data to the server
          * @throws Exception     if an error occurs.
            private void sendRequest(PrintWriter out) throws Exception {
                String path = props.getProperty("path");
                out.println("POST " + path + " HTTP/1.0");
                final String BOUNDARY = "7d03135102b8";
                out.println("Content-Type: multipart/form-data; boundary=" +
                            BOUNDARY);
                String uploadFile = props.getProperty("uploadFile");
                String authString =
                    props.getProperty("bcUserName") + ":" + props.getProperty("bcPassword");
                String encodedAuthString =
                    "Basic " + new sun.misc.BASE64Encoder().encode(authString.getBytes());
                out.println("Authorization: " + encodedAuthString);
                final String CRLF = "\r\n";
                StringBuffer sbuf = new StringBuffer();
                sbuf.append("--" + BOUNDARY + CRLF);
                sbuf.append("Content-Disposition: form-data; name=\"upfile\"; filename=\"" +
                            uploadFile + "\"" + CRLF);
                sbuf.append("Content-Type: text/plain" + CRLF + CRLF);
                FileReader fi = new FileReader(uploadFile);
                char[] buf = new char[1024000];
                int cnt = fi.read(buf);
                sbuf.append(buf, 0, cnt);
                sbuf.append(CRLF);
                sbuf.append("--" + BOUNDARY + "--" + CRLF);
                int sz = sbuf.length();
                out.println("Content-Length: " + sz);
                out.println();
                out.println(sbuf);
                out.flush();
                // Make sure there were no surprises
                if (out.checkError())
                    System.out.println("SSLFileTransfer: java.io.PrintWriter error");
       * readResponse(): reads response from the server
          * @param in          stream to get the data from the server
          * @throws Exception     if an error occurs.
            private void readResponse(BufferedReader in) throws Exception {
                boolean successful = false;
                String inputLine;
                while ((inputLine = in.readLine()) != null) {
                    if (inputLine.startsWith("HTTP") &&
                        inputLine.indexOf("200") >= 0)
                        successful = true;
                    System.out.println(inputLine);
                System.out.println("UPLOAD FILE " +
                                   (successful ? "SUCCESSFUL" : "FAILED") +
                                   "!!!\n");
       * upload(): upload file to server
          * @throws Exception     if an error occurs.
            public void upload() throws Exception {
                try {
                    SSLSocketFactory factory = getFactory();
                    SSLSocket socket =
                        (SSLSocket)factory.createSocket(getHost(), getPort());
                    PrintWriter out =
                        new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())));
                    BufferedReader in =
                        new BufferedReader(new InputStreamReader(socket.getInputStream()));
                    socket.startHandshake();
                    sendRequest(out);
                    readResponse(in);
                    out.close();
                    in.close();
                    socket.close();
                } catch (Exception e) {
                    e.printStackTrace();
                    throw e;
       * main(): main method to start file transfer
          * @param args          command line arguments (property file, see usage())
          * @throws Exception     if an error occurs.
            public static void main(String[] args) throws Exception {
                if (args == null || args.length != 1)
                    usage();
                SSLFileTransfer fileXfer = new SSLFileTransfer();
                fileXfer.init(args[0]);
                fileXfer.upload();
        lRC.setCompletion(ReqCompletion.NORMAL,CompletionText) ;
    }Thanks,
    R

    I believe the OP is aware of this :) -- Re: Oracle 11i - 11.5.10.2 - and Java
    Thanks,
    Hussein

  • How to invoke action class with in a function in jsp in struts

    ex
    if(condion)
    we have to use tag
    window.location="example.do";
    thank u
    sreevatsa adiraju

    hi,
    if that condition is like validation means, better to use client side script to execute when your condition is satisfied....
    if my above answer is not satisfied to you means,,
    post your code & ask in that...

  • How to create test classes with JUnit?

    Hello,
    I need to test my classes with JUnit. My editor is BlueJ.
    This is my class:
    package model;
    import java.util.*;
    public class Category
        private String name;
        private List<Appointment> appointments;
        private List<ToDo> toDos;
        public Category(String name)
            this.name = name;
            appointments = new ArrayList<Appointment>();
            toDos = new ArrayList<ToDo>();
        public String getName()
            return this.name;
        public void setName(String newName)
            this.name = newName;
        public void addAppointment(Appointment a)
            appointments.add(a);
        public void removeAppointment(Appointment a)
            appointments.remove(a);
        public void addToDo(ToDo t)
            toDos.add(t);
        public void removeToDo(ToDo t)
            toDos.remove(t);
        public List<Appointment> getAppointments()
            return appointments;
        public List<ToDo> getToDos()
            return toDos;
    }This is my JUnit test class code so far:
    package model;
    import java.util.*;
    * The test class CategoryTest.
    * @author  (your name)
    * @version (a version number or a date)
    public class CategoryTest extends junit.framework.TestCase
       private Category cat;
        protected void setUp()
            cat = new Category("Kategori");
        public void testGetAndSetName()
            assertTrue(cat.getName().equals("Kategori"));
            cat.setName("Kategori 2");
            assertTrue(cat.getName().equals("Kategori 2"));
            assertFalse(cat.getName().equals("Kategori"));
    }Any hint would be appreicted.
    Best regards,
    Turtle

    jonasse wrote:
    Hehe:)
    This is my code:
       private Category cate;
    protected void setUp() {
    text = new Appointment("Aftale",TimeStampGenerator.generate(1, 1, 2009), TimeStampGenerator.generate(1, 2, 2009));
    cate = new Category("Aftaler");
    public void testSetAndGetText() {
    assertTrue(text.getText().equals("Aftale"));
    text.setText("Andre aftaler");
    assertTrue(text.getText().equals("Andre aftaler"));
    public void testSetAndGetCategory()
    assertTrue(text.getText().equals("Aftale"));
    text.setText("Andre Aftaler");
    assertFalse(text.getText().equals("Aftale"));
         public void testGetAndSetStartTime() {
             assertTrue(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2009)));
             text.setStartTime(TimeStampGenerator.generate(1,2,2008));
             assertTrue(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2008)));
             assertFalse(text.getStartTime().equals(TimeStampGenerator.generate(1,2,2009)));
    }The last method compiles, but I get a failure when I run the test. Says no exception message???
    Thanks in advance,
    JonasSo this is where TDD kicks in. Your mission - should you choose to become test-infected - is to write tests that fail, preferably even don't compile, and then write the code that makes them pass. Compilation is no guarantee the thing will work. In all honesty, that test is probably too busy. Ideally, each test case has exactly one assert in it. That way, you can know instantly what's gone wrong. If you reply "but my code can't be tested like that" it's probably time to refactor it so that it can

Maybe you are looking for

  • Vendor return via delvery

    Hi all I have activated vendor return via delivery: MIGO referred to the original good receipt, movemement 122 and delivery type RLL. After that I need to create CREDIT MEMO. When I go in MIRO and select credit memo referred to the purchase order, I

  • WITH clause in insert statement?

    Hi, Can I use a WITH clause in my insert select. Something like this: with q as       select a            , b         from tabc insert into tab( volume_x, volume_y ) select sum( s.volume_x ), sum( s.volume_y )   from (          select q.a  volume_x  

  • Displaying Report in Web layout

    Hello All, Can anyone please tell me how to display reports in web layout during runtime. I've created a report in month_report.jsp, having both Web Layout & Paper Layouts. At runtime when I call the report the Paper Layout version is getting display

  • Sort Rows by Color?

    I have color coded some of the rows for a project I'm working on and would love to sort all the 'colored' rows together. Is there a way to sort by the color that I've chosen to fill each row with? When I had only two colors I was using a workaround.

  • Blurb paper profiles

    Are there any profiles available for the papers blurb use so we can at least soft proof our images before sending?