You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by gs...@apache.org on 2007/10/30 11:15:04 UTC
svn commit: r590019 - in /wicket/trunk/testing/wicket-threadtest/src:
main/java/org/apache/wicket/threadtest/
main/java/org/apache/wicket/threadtest/apps/app1/
main/java/org/apache/wicket/threadtest/apps/app2/
main/java/org/apache/wicket/threadtest/tes...
Author: gseitz
Date: Tue Oct 30 03:15:02 2007
New Revision: 590019
URL: http://svn.apache.org/viewvc?rev=590019&view=rev
Log:
format sourcecode (somehow didn't work for WICKET-1078)
Modified:
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test2.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test3.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App2Test1.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Contact.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactDataProvider.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactGenerator.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactsDatabase.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DatabaseLocator.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DetachableContactModel.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/FormInputModel.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Home.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/UsPhoneNumber.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Connection.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Home.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Pool.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestApp2.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestFilter.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractCommand.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractGetCommand.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Command.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/CommandRunner.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/SimpleGetCommand.java
wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Tester.java
wicket/trunk/testing/wicket-threadtest/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test1.java Tue Oct 30 03:15:02 2007
@@ -30,7 +30,8 @@
/**
* @author eelcohillenius
*/
-public class App1Test1 {
+public class App1Test1
+{
private static final Log log = LogFactory.getLog(App1Test1.class);
@@ -38,11 +39,12 @@
* @param args
* @throws Exception
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception
+ {
List<String> gets = Arrays.asList(new String[] {
- "/app1/?wicket:bookmarkablePage=:org.apache.wicket.threadtest.apps.app1.Home" ,
- "/app1/?wicket:interface=:${iteration}:link::ILinkListener::" ,
+ "/app1/?wicket:bookmarkablePage=:org.apache.wicket.threadtest.apps.app1.Home",
+ "/app1/?wicket:interface=:${iteration}:link::ILinkListener::",
"/app1/?wicket:interface=:${iteration}:link:1:ILinkListener::",
"/app1/?wicket:interface=:${iteration}:link:2:ILinkListener::" });
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test2.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test2.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test2.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test2.java Tue Oct 30 03:15:02 2007
@@ -27,7 +27,8 @@
/**
* @author eelcohillenius
*/
-public class App1Test2 {
+public class App1Test2
+{
private static final Log log = LogFactory.getLog(App1Test2.class);
@@ -35,7 +36,8 @@
* @param args
* @throws Exception
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception
+ {
List<String> gets = Arrays
.asList(new String[] { "/app1?wicket:bookmarkablePage=one:org.apache.wicket.threadtest.apps.app1.Home" });
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test3.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test3.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test3.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App1Test3.java Tue Oct 30 03:15:02 2007
@@ -28,7 +28,8 @@
/**
* @author almaw
*/
-public class App1Test3 {
+public class App1Test3
+{
private static final Log log = LogFactory.getLog(App1Test3.class);
@@ -36,12 +37,16 @@
* @param args
* @throws Exception
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception
+ {
List<String> gets = new ArrayList<String>();
- gets.add("/app1?wicket:bookmarkablePage=one:org.apache.wicket.threadtest.apps.app1.ResourceTestPage");
- for (int i = 0; i < ResourceTestPage.IMAGES_PER_PAGE; i++) {
- gets.add("/app1?wicket:interface=one:${iteration}:listView:" + i + ":image::IResourceListener");
+ gets
+ .add("/app1?wicket:bookmarkablePage=one:org.apache.wicket.threadtest.apps.app1.ResourceTestPage");
+ for (int i = 0; i < ResourceTestPage.IMAGES_PER_PAGE; i++)
+ {
+ gets.add("/app1?wicket:interface=one:${iteration}:listView:" + i
+ + ":image::IResourceListener");
}
SimpleGetCommand getCmd = new SimpleGetCommand(gets, 5);
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App2Test1.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App2Test1.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App2Test1.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/App2Test1.java Tue Oct 30 03:15:02 2007
@@ -27,7 +27,8 @@
/**
* @author eelcohillenius
*/
-public class App2Test1 {
+public class App2Test1
+{
private static final Log log = LogFactory.getLog(App2Test1.class);
@@ -35,7 +36,8 @@
* @param args
* @throws Exception
*/
- public static void main(String[] args) throws Exception {
+ public static void main(String[] args) throws Exception
+ {
List<String> gets = Arrays
.asList(new String[] { "/app2?wicket:bookmarkablePage=one:org.apache.wicket.threadtest.apps.app2.Home" });
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Contact.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Contact.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Contact.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Contact.java Tue Oct 30 03:15:02 2007
@@ -24,7 +24,8 @@
* @author igor
*
*/
-public class Contact implements Serializable {
+public class Contact implements Serializable
+{
private String cellPhone;
private String firstName;
@@ -38,7 +39,8 @@
/**
* Constructor
*/
- public Contact() {
+ public Contact()
+ {
}
@@ -48,7 +50,8 @@
* @param firstName
* @param lastName
*/
- public Contact(String firstName, String lastName) {
+ public Contact(String firstName, String lastName)
+ {
this.firstName = firstName;
this.lastName = lastName;
}
@@ -57,19 +60,27 @@
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(Object obj) {
- if (obj == this) {
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
return true;
}
- if (obj == null) {
+ if (obj == null)
+ {
return false;
}
- if (obj instanceof Contact) {
- Contact other = (Contact) obj;
- return other.getFirstName().equals(getFirstName()) && other.getLastName().equals(getLastName())
- && other.getHomePhone().equals(getHomePhone()) && other.getCellPhone().equals(getCellPhone());
+ if (obj instanceof Contact)
+ {
+ Contact other = (Contact)obj;
+ return other.getFirstName().equals(getFirstName())
+ && other.getLastName().equals(getLastName())
+ && other.getHomePhone().equals(getHomePhone())
+ && other.getCellPhone().equals(getCellPhone());
- } else {
+ }
+ else
+ {
return false;
}
}
@@ -77,70 +88,80 @@
/**
* @return cellPhone
*/
- public String getCellPhone() {
+ public String getCellPhone()
+ {
return cellPhone;
}
/**
* @return firstName
*/
- public String getFirstName() {
+ public String getFirstName()
+ {
return firstName;
}
/**
* @return homePhone
*/
- public String getHomePhone() {
+ public String getHomePhone()
+ {
return homePhone;
}
/**
* @return id
*/
- public long getId() {
+ public long getId()
+ {
return id;
}
/**
* @return lastName
*/
- public String getLastName() {
+ public String getLastName()
+ {
return lastName;
}
/**
* @param cellPhone
*/
- public void setCellPhone(String cellPhone) {
+ public void setCellPhone(String cellPhone)
+ {
this.cellPhone = cellPhone;
}
/**
* @param firstName
*/
- public void setFirstName(String firstName) {
+ public void setFirstName(String firstName)
+ {
this.firstName = firstName;
}
/**
* @param homePhone
*/
- public void setHomePhone(String homePhone) {
+ public void setHomePhone(String homePhone)
+ {
this.homePhone = homePhone;
}
/**
* @param id
*/
- public void setId(long id) {
+ public void setId(long id)
+ {
this.id = id;
}
/**
* @param lastName
*/
- public void setLastName(String lastName) {
+ public void setLastName(String lastName)
+ {
this.lastName = lastName;
}
@@ -148,9 +169,10 @@
* @see java.lang.Object#toString()
*/
@Override
- public String toString() {
- return "[Contact id=" + id + " firstName=" + firstName + " lastName=" + lastName + " homePhone=" + homePhone
- + " cellPhone=" + cellPhone + "]";
+ public String toString()
+ {
+ return "[Contact id=" + id + " firstName=" + firstName + " lastName=" + lastName
+ + " homePhone=" + homePhone + " cellPhone=" + cellPhone + "]";
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactDataProvider.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactDataProvider.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactDataProvider.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactDataProvider.java Tue Oct 30 03:15:02 2007
@@ -28,8 +28,10 @@
* @author igor
*
*/
-public class ContactDataProvider implements IDataProvider {
- protected ContactsDatabase getContactsDB() {
+public class ContactDataProvider implements IDataProvider
+{
+ protected ContactsDatabase getContactsDB()
+ {
return DatabaseLocator.getDatabase();
}
@@ -40,7 +42,8 @@
* @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int,
* int)
*/
- public Iterator iterator(int first, int count) {
+ public Iterator iterator(int first, int count)
+ {
return getContactsDB().find(first, count, "firstName", true).iterator();
}
@@ -49,7 +52,8 @@
*
* @see org.apache.wicket.markup.repeater.data.IDataProvider#size()
*/
- public int size() {
+ public int size()
+ {
return getContactsDB().getCount();
}
@@ -58,14 +62,16 @@
*
* @see org.apache.wicket.markup.repeater.data.IDataProvider#model(java.lang.Object)
*/
- public IModel model(Object object) {
- return new DetachableContactModel((Contact) object);
+ public IModel model(Object object)
+ {
+ return new DetachableContactModel((Contact)object);
}
/**
* @see org.apache.wicket.model.IDetachable#detach()
*/
- public void detach() {
+ public void detach()
+ {
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactGenerator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactGenerator.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactGenerator.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactGenerator.java Tue Oct 30 03:15:02 2007
@@ -24,7 +24,8 @@
* @author igor
*
*/
-public class ContactGenerator {
+public class ContactGenerator
+{
private static ContactGenerator instance = new ContactGenerator();
private static long nextId = 1;
@@ -32,19 +33,23 @@
/**
* @return static instance of generator
*/
- public static ContactGenerator getInstance() {
+ public static ContactGenerator getInstance()
+ {
return instance;
}
- private String[] firstNames = { "Jacob", "Emily", "Michael", "Sarah", "Matthew", "Brianna", "Nicholas", "Samantha",
- "Christopher", "Hailey", "Abner", "Abby", "Joshua", "Douglas", "Jack", "Keith", "Gerald", "Samuel",
- "Willie", "Larry", "Jose", "Timothy", "Sandra", "Kathleen", "Pamela", "Virginia", "Debra", "Maria", "Linda" };
-
- private String[] lastNames = { "Smiith", "Johnson", "Williams", "Jones", "Brown", "Donahue", "Bailey", "Rose",
- "Allen", "Black", "Davis", "Clark", "Hall", "Lee", "Baker", "Gonzalez", "Nelson", "Moore", "Wilson",
- "Graham", "Fisher", "Cruz", "Ortiz", "Gomez", "Murray" };
+ private String[] firstNames = { "Jacob", "Emily", "Michael", "Sarah", "Matthew", "Brianna",
+ "Nicholas", "Samantha", "Christopher", "Hailey", "Abner", "Abby", "Joshua", "Douglas",
+ "Jack", "Keith", "Gerald", "Samuel", "Willie", "Larry", "Jose", "Timothy", "Sandra",
+ "Kathleen", "Pamela", "Virginia", "Debra", "Maria", "Linda" };
+
+ private String[] lastNames = { "Smiith", "Johnson", "Williams", "Jones", "Brown", "Donahue",
+ "Bailey", "Rose", "Allen", "Black", "Davis", "Clark", "Hall", "Lee", "Baker",
+ "Gonzalez", "Nelson", "Moore", "Wilson", "Graham", "Fisher", "Cruz", "Ortiz", "Gomez",
+ "Murray" };
- private ContactGenerator() {
+ private ContactGenerator()
+ {
}
@@ -53,7 +58,8 @@
*
* @return generated contact
*/
- public Contact generate() {
+ public Contact generate()
+ {
Contact contact = new Contact(randomString(firstNames), randomString(lastNames));
contact.setId(generateId());
contact.setHomePhone(generatePhoneNumber());
@@ -68,8 +74,10 @@
* @param collection
* @param count
*/
- public void generate(Collection<Contact> collection, int count) {
- for (int i = 0; i < count; i++) {
+ public void generate(Collection<Contact> collection, int count)
+ {
+ for (int i = 0; i < count; i++)
+ {
collection.add(generate());
}
}
@@ -77,21 +85,26 @@
/**
* @return unique id
*/
- public synchronized long generateId() {
+ public synchronized long generateId()
+ {
return nextId++;
}
- private String generatePhoneNumber() {
- return new StringBuffer().append(rint(2, 9)).append(rint(0, 9)).append(rint(0, 9)).append("-555-").append(
- rint(1, 9)).append(rint(0, 9)).append(rint(0, 9)).append(rint(0, 9)).toString();
+ private String generatePhoneNumber()
+ {
+ return new StringBuffer().append(rint(2, 9)).append(rint(0, 9)).append(rint(0, 9)).append(
+ "-555-").append(rint(1, 9)).append(rint(0, 9)).append(rint(0, 9))
+ .append(rint(0, 9)).toString();
}
- private String randomString(String[] choices) {
+ private String randomString(String[] choices)
+ {
return choices[rint(0, choices.length)];
}
- private int rint(int min, int max) {
- return (int) (Math.random() * (max - min) + min);
+ private int rint(int min, int max)
+ {
+ return (int)(Math.random() * (max - min) + min);
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactsDatabase.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactsDatabase.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactsDatabase.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/ContactsDatabase.java Tue Oct 30 03:15:02 2007
@@ -29,7 +29,8 @@
* @author igor
*
*/
-public class ContactsDatabase {
+public class ContactsDatabase
+{
private List<Contact> fnameDescIdx = Collections.synchronizedList(new ArrayList<Contact>());
@@ -47,8 +48,10 @@
* @param count
* number of contacts to generate at startup
*/
- public ContactsDatabase(int count) {
- for (int i = 0; i < count; i++) {
+ public ContactsDatabase(int count)
+ {
+ for (int i = 0; i < count; i++)
+ {
add(ContactGenerator.getInstance().generate());
}
updateIndecies();
@@ -59,8 +62,9 @@
*
* @param contact
*/
- public void delete(final Contact contact) {
- Contact c = (Contact) map.remove(new Long(contact.getId()));
+ public void delete(final Contact contact)
+ {
+ Contact c = (Contact)map.remove(new Long(contact.getId()));
fnameIdx.remove(contact);
lnameIdx.remove(contact);
@@ -79,7 +83,8 @@
* @param sortAsc
* @return list of contacts
*/
- public List find(int first, int count, String sortProperty, boolean sortAsc) {
+ public List find(int first, int count, String sortProperty, boolean sortAsc)
+ {
List sublist = getIndex(sortProperty, sortAsc).subList(first, first + count);
return sublist;
}
@@ -90,9 +95,11 @@
* @param id
* @return contact
*/
- public Contact get(long id) {
- Contact c = (Contact) map.get(new Long(id));
- if (c == null) {
+ public Contact get(long id)
+ {
+ Contact c = (Contact)map.get(new Long(id));
+ if (c == null)
+ {
throw new RuntimeException("contact with id [" + id + "] not found in the database");
}
return c;
@@ -101,7 +108,8 @@
/**
* @return number of contacts in the database
*/
- public int getCount() {
+ public int getCount()
+ {
return fnameIdx.size();
}
@@ -110,17 +118,23 @@
*
* @param contact
*/
- public void save(final Contact contact) {
- if (contact.getId() == 0) {
+ public void save(final Contact contact)
+ {
+ if (contact.getId() == 0)
+ {
contact.setId(ContactGenerator.getInstance().generateId());
add(contact);
updateIndecies();
- } else {
- throw new IllegalArgumentException("contact [" + contact.getFirstName() + "] is already persistent");
+ }
+ else
+ {
+ throw new IllegalArgumentException("contact [" + contact.getFirstName()
+ + "] is already persistent");
}
}
- protected void add(final Contact contact) {
+ protected void add(final Contact contact)
+ {
map.put(new Long(contact.getId()), contact);
fnameIdx.add(contact);
lnameIdx.add(contact);
@@ -128,39 +142,54 @@
lnameDescIdx.add(contact);
}
- protected List getIndex(String prop, boolean asc) {
- if (prop == null) {
+ protected List getIndex(String prop, boolean asc)
+ {
+ if (prop == null)
+ {
return fnameIdx;
}
- if (prop.equals("firstName")) {
+ if (prop.equals("firstName"))
+ {
return (asc) ? fnameIdx : fnameDescIdx;
- } else if (prop.equals("lastName")) {
+ }
+ else if (prop.equals("lastName"))
+ {
return (asc) ? lnameIdx : lnameDescIdx;
}
- throw new RuntimeException("uknown sort option [" + prop + "]. valid options: [firstName] , [lastName]");
+ throw new RuntimeException("uknown sort option [" + prop
+ + "]. valid options: [firstName] , [lastName]");
}
- private void updateIndecies() {
- Collections.sort(fnameIdx, new Comparator<Contact>() {
- public int compare(Contact arg0, Contact arg1) {
+ private void updateIndecies()
+ {
+ Collections.sort(fnameIdx, new Comparator<Contact>()
+ {
+ public int compare(Contact arg0, Contact arg1)
+ {
return arg0.getFirstName().compareTo(arg1.getFirstName());
}
});
- Collections.sort(lnameIdx, new Comparator<Contact>() {
- public int compare(Contact arg0, Contact arg1) {
+ Collections.sort(lnameIdx, new Comparator<Contact>()
+ {
+ public int compare(Contact arg0, Contact arg1)
+ {
return arg0.getLastName().compareTo(arg1.getLastName());
}
});
- Collections.sort(fnameDescIdx, new Comparator<Contact>() {
- public int compare(Contact arg0, Contact arg1) {
+ Collections.sort(fnameDescIdx, new Comparator<Contact>()
+ {
+ public int compare(Contact arg0, Contact arg1)
+ {
return arg1.getFirstName().compareTo(arg0.getFirstName());
}
});
- Collections.sort(lnameDescIdx, new Comparator<Contact>() {
- public int compare(Contact arg0, Contact arg1) {
+ Collections.sort(lnameDescIdx, new Comparator<Contact>()
+ {
+ public int compare(Contact arg0, Contact arg1)
+ {
return arg1.getLastName().compareTo(arg0.getLastName());
}
});
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DatabaseLocator.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DatabaseLocator.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DatabaseLocator.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DatabaseLocator.java Tue Oct 30 03:15:02 2007
@@ -22,11 +22,13 @@
* @author igor
*
*/
-public class DatabaseLocator {
+public class DatabaseLocator
+{
/**
* @return contacts database
*/
- public static ContactsDatabase getDatabase() {
+ public static ContactsDatabase getDatabase()
+ {
return TestApp1.get().getContactsDB();
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DetachableContactModel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DetachableContactModel.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DetachableContactModel.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/DetachableContactModel.java Tue Oct 30 03:15:02 2007
@@ -25,15 +25,18 @@
* @author igor
*
*/
-public class DetachableContactModel extends LoadableDetachableModel {
+public class DetachableContactModel extends LoadableDetachableModel
+{
private long id;
/**
* @param c
*/
- public DetachableContactModel(final Contact c) {
+ public DetachableContactModel(final Contact c)
+ {
super(c);
- if (c == null) {
+ if (c == null)
+ {
throw new IllegalArgumentException();
}
@@ -44,8 +47,10 @@
/**
* @param id
*/
- public DetachableContactModel(final long id) {
- if (id == 0) {
+ public DetachableContactModel(final long id)
+ {
+ if (id == 0)
+ {
throw new IllegalArgumentException();
}
this.id = id;
@@ -59,13 +64,19 @@
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
- public boolean equals(final Object obj) {
- if (obj == this) {
+ public boolean equals(final Object obj)
+ {
+ if (obj == this)
+ {
return true;
- } else if (obj == null) {
+ }
+ else if (obj == null)
+ {
return false;
- } else if (obj instanceof DetachableContactModel) {
- DetachableContactModel other = (DetachableContactModel) obj;
+ }
+ else if (obj instanceof DetachableContactModel)
+ {
+ DetachableContactModel other = (DetachableContactModel)obj;
return other.id == this.id;
}
return false;
@@ -75,11 +86,13 @@
* @see java.lang.Object#hashCode()
*/
@Override
- public int hashCode() {
+ public int hashCode()
+ {
return new Long(id).hashCode();
}
- protected ContactsDatabase getContactsDB() {
+ protected ContactsDatabase getContactsDB()
+ {
return DatabaseLocator.getDatabase();
}
@@ -87,7 +100,8 @@
* @see org.apache.wicket.model.LoadableDetachableModel#load()
*/
@Override
- protected Contact load() {
+ protected Contact load()
+ {
// loads contact from the database
return getContactsDB().get(id);
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/FormInputModel.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/FormInputModel.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/FormInputModel.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/FormInputModel.java Tue Oct 30 03:15:02 2007
@@ -30,12 +30,14 @@
* Simple model object for FormInput example. Has a number of simple properties
* that can be retrieved and set.
*/
-public final class FormInputModel implements Serializable {
+public final class FormInputModel implements Serializable
+{
/**
* Represents a line of text. Hack to get around the fact that strings are
* immutable.
*/
- public final class Line implements Serializable {
+ public final class Line implements Serializable
+ {
private String text;
/**
@@ -43,7 +45,8 @@
*
* @param text
*/
- public Line(String text) {
+ public Line(String text)
+ {
this.text = text;
}
@@ -52,7 +55,8 @@
*
* @return text
*/
- public String getText() {
+ public String getText()
+ {
return text;
}
@@ -62,14 +66,16 @@
* @param text
* text
*/
- public void setText(String text) {
+ public void setText(String text)
+ {
this.text = text;
}
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString()
+ {
return text;
}
}
@@ -86,7 +92,7 @@
private List<Line> lines = new ArrayList<Line>();
- private String numberRadioChoice = (String) Home.NUMBERS.get(0);
+ private String numberRadioChoice = (String)Home.NUMBERS.get(0);
private List numbersCheckGroup = new ArrayList();
@@ -104,10 +110,14 @@
/**
* Construct.
*/
- public FormInputModel() {
- try {
+ public FormInputModel()
+ {
+ try
+ {
urlProperty = new URL("http://wicket.apache.org");
- } catch (MalformedURLException e) {
+ }
+ catch (MalformedURLException e)
+ {
e.printStackTrace();
}
lines.add(new Line("line one"));
@@ -120,7 +130,8 @@
*
* @return booleanProperty
*/
- public Boolean getBooleanProperty() {
+ public Boolean getBooleanProperty()
+ {
return booleanProperty;
}
@@ -129,7 +140,8 @@
*
* @return dateProperty
*/
- public Date getDateProperty() {
+ public Date getDateProperty()
+ {
return dateProperty;
}
@@ -138,7 +150,8 @@
*
* @return doubleProperty
*/
- public Double getDoubleProperty() {
+ public Double getDoubleProperty()
+ {
return doubleProperty;
}
@@ -147,7 +160,8 @@
*
* @return integerInRangeProperty
*/
- public Integer getIntegerInRangeProperty() {
+ public Integer getIntegerInRangeProperty()
+ {
return integerInRangeProperty;
}
@@ -156,7 +170,8 @@
*
* @return integerProperty
*/
- public Integer getIntegerProperty() {
+ public Integer getIntegerProperty()
+ {
return integerProperty;
}
@@ -165,7 +180,8 @@
*
* @return lines
*/
- public List<Line> getLines() {
+ public List<Line> getLines()
+ {
return lines;
}
@@ -174,28 +190,32 @@
*
* @return favoriteColor
*/
- public String getNumberRadioChoice() {
+ public String getNumberRadioChoice()
+ {
return numberRadioChoice;
}
/**
* @return the numbers list
*/
- public List getNumbersCheckGroup() {
+ public List getNumbersCheckGroup()
+ {
return numbersCheckGroup;
}
/**
* @return the group number
*/
- public String getNumbersGroup() {
+ public String getNumbersGroup()
+ {
return this.numbersGroup;
}
/**
* @return the phoneNumberUS
*/
- public UsPhoneNumber getPhoneNumberUS() {
+ public UsPhoneNumber getPhoneNumberUS()
+ {
return phoneNumberUS;
}
@@ -204,7 +224,8 @@
*
* @return selectedSites
*/
- public Set getSiteSelection() {
+ public Set getSiteSelection()
+ {
return siteSelection;
}
@@ -213,7 +234,8 @@
*
* @return stringProperty
*/
- public String getStringProperty() {
+ public String getStringProperty()
+ {
return stringProperty;
}
@@ -222,7 +244,8 @@
*
* @return urlProperty
*/
- public URL getUrlProperty() {
+ public URL getUrlProperty()
+ {
return urlProperty;
}
@@ -232,7 +255,8 @@
* @param booleanProperty
* booleanProperty
*/
- public void setBooleanProperty(Boolean booleanProperty) {
+ public void setBooleanProperty(Boolean booleanProperty)
+ {
this.booleanProperty = booleanProperty;
}
@@ -242,7 +266,8 @@
* @param dateProperty
* dateProperty
*/
- public void setDateProperty(Date dateProperty) {
+ public void setDateProperty(Date dateProperty)
+ {
this.dateProperty = dateProperty;
}
@@ -252,7 +277,8 @@
* @param doubleProperty
* doubleProperty
*/
- public void setDoubleProperty(Double doubleProperty) {
+ public void setDoubleProperty(Double doubleProperty)
+ {
this.doubleProperty = doubleProperty;
}
@@ -262,7 +288,8 @@
* @param integerInRangeProperty
* integerInRangeProperty
*/
- public void setIntegerInRangeProperty(Integer integerInRangeProperty) {
+ public void setIntegerInRangeProperty(Integer integerInRangeProperty)
+ {
this.integerInRangeProperty = integerInRangeProperty;
}
@@ -272,7 +299,8 @@
* @param integerProperty
* integerProperty
*/
- public void setIntegerProperty(Integer integerProperty) {
+ public void setIntegerProperty(Integer integerProperty)
+ {
this.integerProperty = integerProperty;
}
@@ -282,7 +310,8 @@
* @param lines
* lines
*/
- public void setLines(List<Line> lines) {
+ public void setLines(List<Line> lines)
+ {
this.lines = lines;
}
@@ -292,7 +321,8 @@
* @param favoriteColor
* favoriteColor
*/
- public void setNumberRadioChoice(String favoriteColor) {
+ public void setNumberRadioChoice(String favoriteColor)
+ {
this.numberRadioChoice = favoriteColor;
}
@@ -302,7 +332,8 @@
* @param group
* number
*/
- public void setNumbersGroup(String group) {
+ public void setNumbersGroup(String group)
+ {
this.numbersGroup = group;
}
@@ -310,7 +341,8 @@
* @param phoneNumberUS
* the phoneNumberUS to set
*/
- public void setPhoneNumberUS(UsPhoneNumber phoneNumberUS) {
+ public void setPhoneNumberUS(UsPhoneNumber phoneNumberUS)
+ {
this.phoneNumberUS = phoneNumberUS;
}
@@ -320,7 +352,8 @@
* @param selectedSites
* selectedSites
*/
- public void setSiteSelection(Set selectedSites) {
+ public void setSiteSelection(Set selectedSites)
+ {
this.siteSelection = selectedSites;
}
@@ -330,7 +363,8 @@
* @param stringProperty
* stringProperty
*/
- public void setStringProperty(String stringProperty) {
+ public void setStringProperty(String stringProperty)
+ {
this.stringProperty = stringProperty;
}
@@ -340,34 +374,42 @@
* @param urlProperty
* urlProperty
*/
- public void setUrlProperty(URL urlProperty) {
+ public void setUrlProperty(URL urlProperty)
+ {
this.urlProperty = urlProperty;
}
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString()
+ {
StringBuffer b = new StringBuffer();
- b.append("[TestInputObject stringProperty = '").append(stringProperty).append("', integerProperty = ").append(
- integerProperty).append(", doubleProperty = ").append(doubleProperty).append(", dateProperty = ")
- .append(dateProperty).append(", booleanProperty = ").append(booleanProperty).append(
- ", integerInRangeProperty = ").append(integerInRangeProperty).append(", urlProperty = ")
- .append(urlProperty).append(", phoneNumberUS = ").append(phoneNumberUS)
- .append(", numberRadioChoice = ").append(numberRadioChoice).append(", numbersCheckgroup ").append(
- numbersCheckGroup).append(", numberRadioGroup= ").append(numbersGroup);
+ b.append("[TestInputObject stringProperty = '").append(stringProperty).append(
+ "', integerProperty = ").append(integerProperty).append(", doubleProperty = ")
+ .append(doubleProperty).append(", dateProperty = ").append(dateProperty).append(
+ ", booleanProperty = ").append(booleanProperty).append(
+ ", integerInRangeProperty = ").append(integerInRangeProperty).append(
+ ", urlProperty = ").append(urlProperty).append(", phoneNumberUS = ")
+ .append(phoneNumberUS).append(", numberRadioChoice = ").append(numberRadioChoice)
+ .append(", numbersCheckgroup ").append(numbersCheckGroup).append(
+ ", numberRadioGroup= ").append(numbersGroup);
b.append(", selected sites {");
- for (Iterator i = siteSelection.iterator(); i.hasNext();) {
+ for (Iterator i = siteSelection.iterator(); i.hasNext();)
+ {
b.append(i.next());
- if (i.hasNext()) {
+ if (i.hasNext())
+ {
b.append(",");
}
}
b.append("]");
b.append(", lines [");
- for (Iterator i = lines.iterator(); i.hasNext();) {
+ for (Iterator i = lines.iterator(); i.hasNext();)
+ {
b.append(i.next());
- if (i.hasNext()) {
+ if (i.hasNext())
+ {
b.append(", ");
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Home.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Home.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Home.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/Home.java Tue Oct 30 03:15:02 2007
@@ -59,20 +59,25 @@
import org.apache.wicket.validation.validator.NumberValidator;
import org.apache.wicket.version.undo.Change;
-public class Home extends WebPage {
+public class Home extends WebPage
+{
- private class ActionPanel extends Panel {
+ private class ActionPanel extends Panel
+ {
/**
* @param id
* component id
* @param model
* model for contact
*/
- public ActionPanel(String id, IModel model) {
+ public ActionPanel(String id, IModel model)
+ {
super(id, model);
- add(new Link("select") {
- public void onClick() {
- Home.this.selected = (Contact) getParent().getModelObject();
+ add(new Link("select")
+ {
+ public void onClick()
+ {
+ Home.this.selected = (Contact)getParent().getModelObject();
}
});
}
@@ -81,19 +86,23 @@
/**
* Form for collecting input.
*/
- private class InputForm extends Form {
+ private class InputForm extends Form
+ {
/**
* Construct.
*
* @param name
* Component name
*/
- public InputForm(String name) {
+ public InputForm(String name)
+ {
super(name, new CompoundPropertyModel(new FormInputModel()));
add(new LocaleDropDownChoice("localeSelect"));
- add(new Link("defaultLocaleLink") {
- public void onClick() {
- WebRequest request = (WebRequest) getRequest();
+ add(new Link("defaultLocaleLink")
+ {
+ public void onClick()
+ {
+ WebRequest request = (WebRequest)getRequest();
setLocale(request.getLocale());
}
});
@@ -107,7 +116,8 @@
add(dateLabel);
TextField datePropertyTextField = new TextField("dateProperty", Date.class);
add(datePropertyTextField);
- add(new TextField("integerInRangeProperty", Integer.class).add(NumberValidator.range(0, 100)));
+ add(new TextField("integerInRangeProperty", Integer.class).add(NumberValidator.range(0,
+ 100)));
add(new CheckBox("booleanProperty"));
RadioChoice rc = new RadioChoice("numberRadioChoice", NUMBERS).setSuffix("");
rc.setLabel(new Model("number"));
@@ -115,8 +125,10 @@
RadioGroup group = new RadioGroup("numbersGroup");
add(group);
- ListView persons = new ListView("numbers", NUMBERS) {
- protected void populateItem(ListItem item) {
+ ListView persons = new ListView("numbers", NUMBERS)
+ {
+ protected void populateItem(ListItem item)
+ {
item.add(new Radio("radio", item.getModel()));
item.add(new Label("number", item.getModelObjectAsString()));
};
@@ -125,8 +137,10 @@
CheckGroup checks = new CheckGroup("numbersCheckGroup");
add(checks);
- ListView checksList = new ListView("numbers", NUMBERS) {
- protected void populateItem(ListItem item) {
+ ListView checksList = new ListView("numbers", NUMBERS)
+ {
+ protected void populateItem(ListItem item)
+ {
item.add(new Check("check", item.getModel()));
item.add(new Label("number", item.getModelObjectAsString()));
};
@@ -135,17 +149,24 @@
add(new ListMultipleChoice("siteSelection", SITES));
- add(new TextField("urlProperty", URL.class) {
- public IConverter getConverter(Class clazz) {
- return new IConverter() {
+ add(new TextField("urlProperty", URL.class)
+ {
+ public IConverter getConverter(Class clazz)
+ {
+ return new IConverter()
+ {
/**
* @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String,
* java.util.Locale)
*/
- public Object convertToObject(String value, Locale locale) {
- try {
+ public Object convertToObject(String value, Locale locale)
+ {
+ try
+ {
return new URL(value.toString());
- } catch (MalformedURLException e) {
+ }
+ catch (MalformedURLException e)
+ {
throw new ConversionException("'" + value + "' is not a valid URL");
}
}
@@ -154,15 +175,18 @@
* @see org.apache.wicket.util.convert.IConverter#convertToString(java.lang.Object,
* java.util.Locale)
*/
- public String convertToString(Object value, Locale locale) {
+ public String convertToString(Object value, Locale locale)
+ {
return value != null ? value.toString() : null;
}
};
}
});
- add(new TextField("phoneNumberUS", UsPhoneNumber.class) {
- public IConverter getConverter(Class clazz) {
+ add(new TextField("phoneNumberUS", UsPhoneNumber.class)
+ {
+ public IConverter getConverter(Class clazz)
+ {
return new MaskConverter("(###) ###-####", UsPhoneNumber.class);
}
});
@@ -171,8 +195,10 @@
add(new ImageButton("saveButton"));
- add(new Link("resetButtonLink") {
- public void onClick() {
+ add(new Link("resetButtonLink")
+ {
+ public void onClick()
+ {
InputForm.this.modelChanged();
}
}.add(new Image("resetButtonImage")));
@@ -181,25 +207,29 @@
/**
* @see org.apache.wicket.markup.html.form.Form#onSubmit()
*/
- public void onSubmit() {
+ public void onSubmit()
+ {
info("Saved model " + getModelObject());
}
}
/** list view to be nested in the form. */
- private static final class LinesListView extends ListView {
+ private static final class LinesListView extends ListView
+ {
/**
* Construct.
*
* @param id
*/
- public LinesListView(String id) {
+ public LinesListView(String id)
+ {
super(id);
setReuseItems(true);
}
- protected void populateItem(ListItem item) {
+ protected void populateItem(ListItem item)
+ {
item.add(new TextField("lineEdit", new PropertyModel(item.getModel(), "text")));
}
}
@@ -207,18 +237,21 @@
/**
* Choice for a locale.
*/
- private final class LocaleChoiceRenderer extends ChoiceRenderer {
+ private final class LocaleChoiceRenderer extends ChoiceRenderer
+ {
/**
* Constructor.
*/
- public LocaleChoiceRenderer() {
+ public LocaleChoiceRenderer()
+ {
}
/**
* @see org.apache.wicket.markup.html.form.IChoiceRenderer#getDisplayValue(Object)
*/
- public Object getDisplayValue(Object object) {
- Locale locale = (Locale) object;
+ public Object getDisplayValue(Object object)
+ {
+ Locale locale = (Locale)object;
String display = locale.getDisplayName(getLocale());
return display;
}
@@ -227,14 +260,16 @@
/**
* Dropdown with Locales.
*/
- private final class LocaleDropDownChoice extends DropDownChoice {
+ private final class LocaleDropDownChoice extends DropDownChoice
+ {
/**
* Construct.
*
* @param id
* component id
*/
- public LocaleDropDownChoice(String id) {
+ public LocaleDropDownChoice(String id)
+ {
super(id, LOCALES, new LocaleChoiceRenderer());
setModel(new PropertyModel(Home.this, "locale"));
}
@@ -242,41 +277,49 @@
/**
* @see org.apache.wicket.markup.html.form.DropDownChoice#onSelectionChanged(java.lang.Object)
*/
- public void onSelectionChanged(Object newSelection) {
+ public void onSelectionChanged(Object newSelection)
+ {
}
/**
* @see org.apache.wicket.markup.html.form.DropDownChoice#wantOnSelectionChangedNotifications()
*/
- protected boolean wantOnSelectionChangedNotifications() {
+ protected boolean wantOnSelectionChangedNotifications()
+ {
return true;
}
}
/** Relevant locales wrapped in a list. */
- private static final List LOCALES = Arrays.asList(new Locale[] { Locale.ENGLISH, new Locale("nl"), Locale.GERMAN,
- Locale.SIMPLIFIED_CHINESE, Locale.JAPANESE, new Locale("pt", "BR"), new Locale("fa", "IR"),
- new Locale("da", "DK") });
+ private static final List LOCALES = Arrays.asList(new Locale[] { Locale.ENGLISH,
+ new Locale("nl"), Locale.GERMAN, Locale.SIMPLIFIED_CHINESE, Locale.JAPANESE,
+ new Locale("pt", "BR"), new Locale("fa", "IR"), new Locale("da", "DK") });
/** available sites for the multiple select. */
- private static final List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby", "Java.Net" });
+ private static final List SITES = Arrays.asList(new String[] { "The Server Side", "Java Lobby",
+ "Java.Net" });
/** available numbers for the radio selection. */
static final List NUMBERS = Arrays.asList(new String[] { "1", "2", "3" });
private Contact selected;
- public Home() {
+ public Home()
+ {
- add(new Link("link") {
+ add(new Link("link")
+ {
int i = 0;
@Override
- public void onClick() {
+ public void onClick()
+ {
i++;
- addStateChange(new Change() {
+ addStateChange(new Change()
+ {
@Override
- public void undo() {
+ public void undo()
+ {
}
});
}
@@ -284,9 +327,11 @@
add(new Label("selectedLabel", new PropertyModel(this, "selectedContactLabel")));
- add(new DataView("simple", new ContactDataProvider()) {
- protected void populateItem(final Item item) {
- Contact contact = (Contact) item.getModelObject();
+ add(new DataView("simple", new ContactDataProvider())
+ {
+ protected void populateItem(final Item item)
+ {
+ Contact contact = (Contact)item.getModelObject();
item.add(new ActionPanel("actions", item.getModel()));
item.add(new Label("contactid", String.valueOf(contact.getId())));
item.add(new Label("firstname", contact.getFirstName()));
@@ -294,8 +339,10 @@
item.add(new Label("homephone", contact.getHomePhone()));
item.add(new Label("cellphone", contact.getCellPhone()));
- item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel() {
- public Object getObject() {
+ item.add(new AttributeModifier("class", true, new AbstractReadOnlyModel()
+ {
+ public Object getObject()
+ {
return (item.getIndex() % 2 == 1) ? "even" : "odd";
}
}));
@@ -310,10 +357,14 @@
/**
* @return string representation of selceted contact property
*/
- public String getSelectedContactLabel() {
- if (selected == null) {
+ public String getSelectedContactLabel()
+ {
+ if (selected == null)
+ {
return "No Contact Selected";
- } else {
+ }
+ else
+ {
return selected.getFirstName() + " " + selected.getLastName();
}
}
@@ -325,8 +376,10 @@
* @param locale
* The new locale
*/
- public void setLocale(Locale locale) {
- if (locale != null) {
+ public void setLocale(Locale locale)
+ {
+ if (locale != null)
+ {
getSession().setLocale(locale);
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/UsPhoneNumber.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/UsPhoneNumber.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/UsPhoneNumber.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app1/UsPhoneNumber.java Tue Oct 30 03:15:02 2007
@@ -26,7 +26,8 @@
*
* @author Eelco Hillenius
*/
-public class UsPhoneNumber implements Serializable {
+public class UsPhoneNumber implements Serializable
+{
private String number;
/**
@@ -34,7 +35,8 @@
*
* @param number
*/
- public UsPhoneNumber(String number) {
+ public UsPhoneNumber(String number)
+ {
this.number = number;
}
@@ -43,7 +45,8 @@
*
* @return text
*/
- public String getNumber() {
+ public String getNumber()
+ {
return number;
}
@@ -53,14 +56,16 @@
* @param number
* text
*/
- public void setNumber(String number) {
+ public void setNumber(String number)
+ {
this.number = number;
}
/**
* @see java.lang.Object#toString()
*/
- public String toString() {
+ public String toString()
+ {
return number;
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Connection.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Connection.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Connection.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Connection.java Tue Oct 30 03:15:02 2007
@@ -18,21 +18,26 @@
import org.apache.wicket.Session;
-public class Connection {
+public class Connection
+{
private final String id;
- public Connection(String id) {
+ public Connection(String id)
+ {
this.id = id;
}
@Override
- public boolean equals(Object obj) {
- return ((Connection) obj).id.equals(id);
+ public boolean equals(Object obj)
+ {
+ return ((Connection)obj).id.equals(id);
}
- public String getData() {
- return "data[Connection=" + id + ",Session=" + Session.get() + ",Thread=" + Thread.currentThread() + "]";
+ public String getData()
+ {
+ return "data[Connection=" + id + ",Session=" + Session.get() + ",Thread="
+ + Thread.currentThread() + "]";
}
/**
@@ -40,17 +45,20 @@
*
* @return id
*/
- public String getId() {
+ public String getId()
+ {
return id;
}
@Override
- public int hashCode() {
+ public int hashCode()
+ {
return id.hashCode();
}
@Override
- public String toString() {
+ public String toString()
+ {
return "Connection[" + id + "]";
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Home.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Home.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Home.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Home.java Tue Oct 30 03:15:02 2007
@@ -21,14 +21,18 @@
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
-public class Home extends WebPage {
+public class Home extends WebPage
+{
- public Home() {
+ public Home()
+ {
- IModel model = new AbstractReadOnlyModel() {
+ IModel model = new AbstractReadOnlyModel()
+ {
@Override
- public Object getObject() {
+ public Object getObject()
+ {
return Pool.getConnection().getData();
}
};
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Pool.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Pool.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Pool.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/Pool.java Tue Oct 30 03:15:02 2007
@@ -26,21 +26,25 @@
*
* @author eelcohillenius
*/
-public class Pool {
+public class Pool
+{
private static Pool _instance = new Pool();
private static Log log = LogFactory.getLog(Pool.class);
- public static Connection getConnection() {
+ public static Connection getConnection()
+ {
return getInstance().doGetConnection();
}
- public static Pool getInstance() {
+ public static Pool getInstance()
+ {
return _instance;
}
- public static void release() {
+ public static void release()
+ {
getInstance().doRelease();
}
@@ -52,36 +56,49 @@
private int size = 3;
- private Pool() {
+ private Pool()
+ {
allConnections = new Connection[size];
- for (int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++)
+ {
Connection connection = new Connection(String.valueOf(i));
allConnections[i] = connection;
available.push(connection);
}
}
- private synchronized Connection doGetConnection() {
+ private synchronized Connection doGetConnection()
+ {
Connection c = locks.get();
- if (c != null) {
+ if (c != null)
+ {
return c;
- } else {
+ }
+ else
+ {
- while (c == null) {
+ while (c == null)
+ {
- if (!available.isEmpty()) {
+ if (!available.isEmpty())
+ {
c = available.pop();
locks.set(c);
log.info("returning " + c + " for " + Thread.currentThread());
- } else {
- try {
+ }
+ else
+ {
+ try
+ {
log.info("enter wait for " + Thread.currentThread());
wait();
- } catch (InterruptedException e) {
+ }
+ catch (InterruptedException e)
+ {
throw new RuntimeException(e);
}
}
@@ -90,9 +107,11 @@
return c;
}
- private synchronized void doRelease() {
+ private synchronized void doRelease()
+ {
Connection c = locks.get();
- if (c != null) {
+ if (c != null)
+ {
available.push(c);
locks.remove();
log.info("releasing " + c + " for " + Thread.currentThread());
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestApp2.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestApp2.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestApp2.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestApp2.java Tue Oct 30 03:15:02 2007
@@ -21,27 +21,33 @@
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.session.ISessionStore;
-public class TestApp2 extends WebApplication {
+public class TestApp2 extends WebApplication
+{
- public static TestApp2 get() {
- return (TestApp2) Application.get();
+ public static TestApp2 get()
+ {
+ return (TestApp2)Application.get();
}
- public TestApp2() {
+ public TestApp2()
+ {
}
@Override
- public Class getHomePage() {
+ public Class getHomePage()
+ {
return Home.class;
}
@Override
- protected void init() {
+ protected void init()
+ {
getSharedResources().add("cancelButton", new DefaultButtonImageResource("Cancel"));
}
@Override
- protected ISessionStore newSessionStore() {
+ protected ISessionStore newSessionStore()
+ {
return super.newSessionStore();
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestFilter.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestFilter.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestFilter.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/apps/app2/TestFilter.java Tue Oct 30 03:15:02 2007
@@ -28,22 +28,25 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-public class TestFilter implements Filter {
+public class TestFilter implements Filter
+{
private static final Log log = LogFactory.getLog(TestFilter.class);
/**
* @see javax.servlet.Filter#destroy()
*/
- public void destroy() {
+ public void destroy()
+ {
}
/**
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest,
* javax.servlet.ServletResponse, javax.servlet.FilterChain)
*/
- public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
- ServletException {
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
+ throws IOException, ServletException
+ {
chain.doFilter(request, response);
@@ -53,7 +56,8 @@
/**
* @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
*/
- public void init(FilterConfig config) throws ServletException {
+ public void init(FilterConfig config) throws ServletException
+ {
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractCommand.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractCommand.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractCommand.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractCommand.java Tue Oct 30 03:15:02 2007
@@ -18,7 +18,8 @@
import java.util.List;
-public abstract class AbstractCommand implements Command {
+public abstract class AbstractCommand implements Command
+{
/** number of executions of the urls. */
private final int iterations;
@@ -34,7 +35,8 @@
* @param iterations
* number of executions of the urls
*/
- public AbstractCommand(List<String> urls, int iterations) {
+ public AbstractCommand(List<String> urls, int iterations)
+ {
this.urls = urls;
this.iterations = iterations;
}
@@ -44,7 +46,8 @@
*
* @return iterations
*/
- public int getIterations() {
+ public int getIterations()
+ {
return iterations;
}
@@ -53,7 +56,8 @@
*
* @return urls
*/
- public List<String> getUrls() {
+ public List<String> getUrls()
+ {
return urls;
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractGetCommand.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractGetCommand.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractGetCommand.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/AbstractGetCommand.java Tue Oct 30 03:15:02 2007
@@ -21,7 +21,8 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.wicket.util.string.Strings;
-public abstract class AbstractGetCommand extends AbstractCommand {
+public abstract class AbstractGetCommand extends AbstractCommand
+{
/**
* Construct.
@@ -31,21 +32,26 @@
* @param iterations
* number of executions of the urls
*/
- public AbstractGetCommand(List<String> urls, int iterations) {
+ public AbstractGetCommand(List<String> urls, int iterations)
+ {
super(urls, iterations);
}
/**
* @see org.apache.wicket.threadtest.tester.Command#execute(CommandRunner)
*/
- public void execute(CommandRunner runner) throws Exception {
+ public void execute(CommandRunner runner) throws Exception
+ {
int iterations = getIterations();
- for (int i = 0; i < iterations; i++) {
+ for (int i = 0; i < iterations; i++)
+ {
List<String> urls = getUrls();
- for (String url : urls) {
+ for (String url : urls)
+ {
- String modUrl = Strings.replaceAll(url, "${iteration}", String.valueOf(i)).toString();
+ String modUrl = Strings.replaceAll(url, "${iteration}", String.valueOf(i))
+ .toString();
doGet(runner.getClient(), modUrl);
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Command.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Command.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Command.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Command.java Tue Oct 30 03:15:02 2007
@@ -21,7 +21,8 @@
*
* @author eelcohillenius
*/
-public interface Command {
+public interface Command
+{
/**
* Execute one iteration.
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/CommandRunner.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/CommandRunner.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/CommandRunner.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/CommandRunner.java Tue Oct 30 03:15:02 2007
@@ -27,9 +27,11 @@
*
* @author eelcohillenius
*/
-public class CommandRunner implements Runnable {
+public class CommandRunner implements Runnable
+{
- public static interface CommandRunnerObserver {
+ public static interface CommandRunnerObserver
+ {
void onDone(CommandRunner runner);
@@ -50,7 +52,8 @@
* @param commands
* @param client
*/
- public CommandRunner(List<Command> commands, HttpClient client, CommandRunnerObserver observer) {
+ public CommandRunner(List<Command> commands, HttpClient client, CommandRunnerObserver observer)
+ {
this.commands = commands;
this.client = client;
this.observer = observer;
@@ -61,20 +64,27 @@
*
* @return the HTTP client
*/
- public HttpClient getClient() {
+ public HttpClient getClient()
+ {
return this.client;
}
/**
* @see java.lang.Runnable#run()
*/
- public void run() {
+ public void run()
+ {
- for (Command command : commands) {
- try {
+ for (Command command : commands)
+ {
+ try
+ {
command.execute(this);
- } catch (Exception e) {
- log.fatal("execution of command " + command + ", thread " + Thread.currentThread() + " failed", e);
+ }
+ catch (Exception e)
+ {
+ log.fatal("execution of command " + command + ", thread " + Thread.currentThread()
+ + " failed", e);
observer.onError(this, e);
return;
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/SimpleGetCommand.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/SimpleGetCommand.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/SimpleGetCommand.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/SimpleGetCommand.java Tue Oct 30 03:15:02 2007
@@ -25,7 +25,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.wicket.util.io.Streams;
-public class SimpleGetCommand extends AbstractGetCommand {
+public class SimpleGetCommand extends AbstractGetCommand
+{
private static final Log log = LogFactory.getLog(SimpleGetCommand.class);
@@ -39,7 +40,8 @@
* @param iterations
* number of executions of the urls
*/
- public SimpleGetCommand(List<String> urls, int iterations) {
+ public SimpleGetCommand(List<String> urls, int iterations)
+ {
super(urls, iterations);
}
@@ -51,7 +53,8 @@
* @param iterations
* number of executions of the urls
*/
- public SimpleGetCommand(String url, int iterations) {
+ public SimpleGetCommand(String url, int iterations)
+ {
super(Arrays.asList(new String[] { url }), iterations);
}
@@ -60,7 +63,8 @@
*
* @return printResponse
*/
- public boolean getPrintResponse() {
+ public boolean getPrintResponse()
+ {
return printResponse;
}
@@ -70,7 +74,8 @@
* @param printResponse
* printResponse
*/
- public void setPrintResponse(boolean printResponse) {
+ public void setPrintResponse(boolean printResponse)
+ {
this.printResponse = printResponse;
}
@@ -79,22 +84,28 @@
* java.lang.String)
*/
@Override
- protected void doGet(HttpClient client, String url) throws Exception {
+ protected void doGet(HttpClient client, String url) throws Exception
+ {
GetMethod method = new GetMethod(url);
method.setFollowRedirects(true);
- try {
+ try
+ {
int code = client.executeMethod(method);
- if (code != 200) {
+ if (code != 200)
+ {
log.error("ERROR! code: " + code);
log.error(Streams.readString(method.getResponseBodyAsStream()));
// TODO rather than failing, just gather statistics
// throw new Exception(new String(method.getResponseBody()));
}
- if (getPrintResponse()) {
+ if (getPrintResponse())
+ {
log.info("\n" + Streams.readString(method.getResponseBodyAsStream()));
}
- } finally {
+ }
+ finally
+ {
method.releaseConnection();
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Tester.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Tester.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Tester.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/main/java/org/apache/wicket/threadtest/tester/Tester.java Tue Oct 30 03:15:02 2007
@@ -34,13 +34,15 @@
/**
* @author eelcohillenius
*/
-public final class Tester implements CommandRunnerObserver {
+public final class Tester implements CommandRunnerObserver
+{
private static final Log log = LogFactory.getLog(Tester.class);
private static HttpClientParams params;
- static {
+ static
+ {
params = new HttpClientParams();
params.setParameter(HttpClientParams.ALLOW_CIRCULAR_REDIRECTS, true);
}
@@ -50,20 +52,28 @@
*
* @param args
*/
- public static void main(String[] args) {
+ public static void main(String[] args)
+ {
// start server on its own
int port = 8090;
- if (args.length > 0) {
+ if (args.length > 0)
+ {
port = Integer.valueOf(args[0]);
}
Server server = startServer(port);
- try {
+ try
+ {
server.start();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
e.printStackTrace();
- try {
+ try
+ {
server.stop();
- } catch (Exception e1) {
+ }
+ catch (Exception e1)
+ {
e1.printStackTrace();
}
System.exit(1);
@@ -76,15 +86,19 @@
* @param port
* @return server handle
*/
- private static Server startServer(int port) {
+ private static Server startServer(int port)
+ {
Server server;
// start up server
server = new Server(port);
WebAppContext ctx = new WebAppContext("./src/main/webapp", "/");
server.addHandler(ctx);
- try {
+ try
+ {
server.start();
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
throw new RuntimeException(e);
}
return server;
@@ -119,7 +133,8 @@
* false, the test behaves like one client issuing multiple
* concurrent requests
*/
- public Tester(Command command, int numberOfThreads, boolean multipleSessions) {
+ public Tester(Command command, int numberOfThreads, boolean multipleSessions)
+ {
this(Arrays.asList(new Command[] { command }), numberOfThreads, multipleSessions);
}
@@ -136,7 +151,8 @@
* false, the test behaves like one client issuing multiple
* concurrent requests
*/
- public Tester(List<Command> commands, int numberOfThreads, boolean multipleSessions) {
+ public Tester(List<Command> commands, int numberOfThreads, boolean multipleSessions)
+ {
this.commands = commands;
this.numberOfThreads = numberOfThreads;
this.multipleSessions = multipleSessions;
@@ -147,7 +163,8 @@
*
* @return host
*/
- public String getHost() {
+ public String getHost()
+ {
return host;
}
@@ -156,16 +173,19 @@
*
* @return port
*/
- public int getPort() {
+ public int getPort()
+ {
return port;
}
- public synchronized void onDone(CommandRunner runner) {
+ public synchronized void onDone(CommandRunner runner)
+ {
activeThreads--;
notifyAll();
}
- public synchronized void onError(CommandRunner runner, Exception e) {
+ public synchronized void onError(CommandRunner runner, Exception e)
+ {
activeThreads--;
notifyAll();
}
@@ -175,7 +195,8 @@
*
* @throws Exception
*/
- public void run() throws Exception {
+ public void run() throws Exception
+ {
activeThreads = 0;
@@ -186,31 +207,43 @@
Server server = null;
GetMethod getMethod = new GetMethod("http://localhost:" + port + "/");
- try {
+ try
+ {
getMethod.setFollowRedirects(true);
HttpClient httpClient = new HttpClient(params, manager);
int code = httpClient.executeMethod(getMethod);
- if (code != 200) {
+ if (code != 200)
+ {
server = startServer(port);
}
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
server = startServer(port);
- } finally {
+ }
+ finally
+ {
getMethod.releaseConnection();
}
- try {
+ try
+ {
ThreadGroup g = new ThreadGroup("runners");
Thread[] threads = new Thread[numberOfThreads];
HttpClient client = null;
- for (int i = 0; i < numberOfThreads; i++) {
+ for (int i = 0; i < numberOfThreads; i++)
+ {
- if (multipleSessions) {
+ if (multipleSessions)
+ {
client = new HttpClient(params, manager);
client.getHostConfiguration().setHost(host, port);
- } else {
- if (client == null) {
+ }
+ else
+ {
+ if (client == null)
+ {
client = new HttpClient(params, manager);
client.getHostConfiguration().setHost(host, port);
}
@@ -220,24 +253,31 @@
long start = System.currentTimeMillis();
- for (int i = 0; i < numberOfThreads; i++) {
+ for (int i = 0; i < numberOfThreads; i++)
+ {
activeThreads++;
threads[i].start();
}
- while (activeThreads > 0) {
- synchronized (this) {
+ while (activeThreads > 0)
+ {
+ synchronized (this)
+ {
wait();
}
}
long end = System.currentTimeMillis();
long time = end - start;
- log.info("\n******** finished in " + Duration.milliseconds(time) + " (" + time + " milis)");
+ log.info("\n******** finished in " + Duration.milliseconds(time) + " (" + time
+ + " milis)");
- } finally {
+ }
+ finally
+ {
MultiThreadedHttpConnectionManager.shutdownAll();
- if (server != null) {
+ if (server != null)
+ {
server.stop();
}
}
@@ -249,7 +289,8 @@
* @param host
* host
*/
- public void setHost(String host) {
+ public void setHost(String host)
+ {
this.host = host;
}
@@ -259,7 +300,8 @@
* @param port
* port
*/
- public void setPort(int port) {
+ public void setPort(int port)
+ {
this.port = port;
}
}
Modified: wicket/trunk/testing/wicket-threadtest/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/testing/wicket-threadtest/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java?rev=590019&r1=590018&r2=590019&view=diff
==============================================================================
--- wicket/trunk/testing/wicket-threadtest/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java (original)
+++ wicket/trunk/testing/wicket-threadtest/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java Tue Oct 30 03:15:02 2007
@@ -23,12 +23,14 @@
*
* @author Frank Bille Jensen (frankbille)
*/
-public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase {
+public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
+{
/**
* Construct.
*/
- public ApacheLicenceHeaderTest() {
+ public ApacheLicenceHeaderTest()
+ {
// addHeaders = true;
}