Skip to content

Commit

Permalink
Some cleanups for the tools folder
Browse files Browse the repository at this point in the history
* Formatting of Java code
* Tidying of poms
  • Loading branch information
arjantijms committed Jan 2, 2025
1 parent 35724e4 commit bfb359b
Show file tree
Hide file tree
Showing 333 changed files with 47,471 additions and 51,513 deletions.
11 changes: 9 additions & 2 deletions tools/common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,23 @@
<description>COMMON</description>
<url>https://github.com/jakartaee/platform-tck</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<jakarta.tck.tools.version>11.0.0-SNAPSHOT</jakarta.tck.tools.version>
</properties>

<dependencies>
<dependency>
<groupId>jakarta.tck</groupId>
<artifactId>runtime</artifactId>
<version>11.0.0-SNAPSHOT</version>
<version>${jakarta.tck.tools.version}</version>
</dependency>
<dependency>
<groupId>jakarta.tck</groupId>
<artifactId>libutil</artifactId>
<version>11.0.0-SNAPSHOT</version>
<version>${jakarta.tck.tools.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,70 +20,70 @@
* A simple JavaBean class to be used as a custom resource type.
*/
public class Dog implements java.io.Serializable {
public static final String DOG_NAME = "wangwang";

public static final int DOG_AGE = 2;

private static Dog instance = new Dog();

private int age = DOG_AGE;

private String name = DOG_NAME;

public Dog() {
}

public static Dog getInstance() {
return instance;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@Override
public String toString() {
String retValue;
retValue = super.toString() + ", name=" + name + ", age=" + age;
return retValue;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((name == null) ? 0 : name.hashCode());
result = PRIME * result + age;
return result;
}

@Override
public boolean equals(Object anObject) {
if (this == anObject) {
return true;
public static final String DOG_NAME = "wangwang";

public static final int DOG_AGE = 2;

private static Dog instance = new Dog();

private int age = DOG_AGE;

private String name = DOG_NAME;

public Dog() {
}

public static Dog getInstance() {
return instance;
}

public int getAge() {
return age;
}

public void setAge(int age) {
this.age = age;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}
if (anObject instanceof Dog) {
Dog anotherDog = (Dog) anObject;
return (this.age == anotherDog.age && this.name.equals(anotherDog.name));

@Override
public String toString() {
String retValue;
retValue = super.toString() + ", name=" + name + ", age=" + age;
return retValue;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int PRIME = 31;
int result = 1;
result = PRIME * result + ((name == null) ? 0 : name.hashCode());
result = PRIME * result + age;
return result;
}

@Override
public boolean equals(Object anObject) {
if (this == anObject) {
return true;
}
if (anObject instanceof Dog) {
Dog anotherDog = (Dog) anObject;
return (this.age == anotherDog.age && this.name.equals(anotherDog.name));
}
return false;
}
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
import javax.naming.spi.ObjectFactory;

/**
* A simple factory class for creating custom JNDI resource of type
* com.sun.ts.lib.deliverable.cts.resource.Dog
* A simple factory class for creating custom JNDI resource of type com.sun.ts.lib.deliverable.cts.resource.Dog
*/
public class DogFactory implements ObjectFactory {

public DogFactory() {
}
public DogFactory() {
}

public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable<?, ?> environment) throws Exception {
Dog dog = Dog.getInstance();
System.out.println("Creating a dog whose name is " + dog.getName()
+ ", and age is " + dog.getAge());
return dog;
}
public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
Dog dog = Dog.getInstance();
System.out.println("Creating a dog whose name is " + dog.getName() + ", and age is " + dog.getAge());
return dog;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CleanupMethod {
public String name();
public String name();
}
Loading

0 comments on commit bfb359b

Please sign in to comment.