[jboss-svn-commits] JBL Code SVN: r34804 - in labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test: resources and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 19 18:44:42 EDT 2010


Author: diegoll
Date: 2010-08-19 18:44:42 -0400 (Thu, 19 Aug 2010)
New Revision: 34804

Added:
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Address.java
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Cheese.java
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/CheeseInterface.java
Modified:
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/META-INF/persistence.xml
   labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/log4j.xml
Log:
adding model

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Address.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Address.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Address.java	2010-08-19 22:44:42 UTC (rev 34804)
@@ -0,0 +1,82 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+public class Address {
+    
+    private String street;
+    private String number;
+    private String phone;
+    
+    public Address() {}
+    
+    public Address( String street, String number, String phone ) {
+        this.street = street;
+        this.number = number;
+        this.phone  = phone;
+    }
+    
+    public String getNumber() {
+        return number;
+    }
+    public void setNumber(String number) {
+        this.number = number;
+    }
+    public String getPhone() {
+        return phone;
+    }
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+    public String getStreet() {
+        return street;
+    }
+    public void setStreet(String street) {
+        this.street = street;
+    }
+    
+    public String toString() {
+        return "Address( "+this.street+", "+this.number+" - phone: "+this.phone+" )";
+    }
+
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((number == null) ? 0 : number.hashCode());
+        result = prime * result + ((phone == null) ? 0 : phone.hashCode());
+        result = prime * result + ((street == null) ? 0 : street.hashCode());
+        return result;
+    }
+
+    public boolean equals(Object obj) {
+        if ( this == obj ) return true;
+        if ( obj == null ) return false;
+        if ( getClass() != obj.getClass() ) return false;
+        Address other = (Address) obj;
+        if ( number == null ) {
+            if ( other.number != null ) return false;
+        } else if ( !number.equals( other.number ) ) return false;
+        if ( phone == null ) {
+            if ( other.phone != null ) return false;
+        } else if ( !phone.equals( other.phone ) ) return false;
+        if ( street == null ) {
+            if ( other.street != null ) return false;
+        } else if ( !street.equals( other.street ) ) return false;
+        return true;
+    }
+
+}

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Cheese.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Cheese.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/Cheese.java	2010-08-19 22:44:42 UTC (rev 34804)
@@ -0,0 +1,150 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+/*
+ * Copyright 2005 JBoss Inc
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+
+public class Cheese
+    implements
+    CheeseInterface {
+
+    public static String staticString;
+
+    static {
+        staticString = "Cheese is tasty";
+    }
+
+    private String       type;
+    
+    private char         charType;
+
+    private int          price;
+
+    public Cheese() {
+    }
+
+    public Cheese(final String type,
+                  final int price) {
+        this.type = type;
+        this.price = price;
+    }
+
+    public static String getStaticString() {
+        return staticString;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.CheeseInterface#getType()
+     */
+    public String getType() {
+        return this.type;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.CheeseInterface#getPrice()
+     */
+    public int getPrice() {
+        return this.price;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.CheeseInterface#setPrice(int)
+     */
+    public void setPrice(final int price) {
+        this.price = price;
+    }
+
+    /* (non-Javadoc)
+     * @see org.drools.CheeseInterface#setType(java.lang.String)
+     */
+    public void setType(final String type) {
+        this.type = type;
+    }
+    
+    /**
+     * This is a test method to test shadow proxy delegation
+     * when in the presence of a long or double parameter
+     * @param newPrice
+     * @param bla
+     */
+    public void updatePriceFromLong( long newPrice, double xyz, String bla ) {
+        this.price = (int) newPrice;
+    }
+
+    public String toString() {
+        return "Cheese type='" + this.type + "' price='" + this.price + "'";
+    }
+
+    public int hashCode() {
+        //like org.apache.commons.lang.builder.HashCodeBuilder
+        int hashCode = 17;
+        hashCode = hashCode * 37 + this.price;
+        hashCode = hashCode * 37 + (this.type == null ? 0 : this.type.hashCode());
+        return hashCode;
+    }
+
+    public boolean equals(final Object object) {
+        if ( object == this ) {
+            return true;
+        }
+
+        if ( object == null || !(object instanceof Cheese) ) {
+            return false;
+        }
+
+        final Cheese other = (Cheese) object;
+
+        return (this.type.equals( other.getType() ) && this.price == other.getPrice());
+    }
+
+    public static int getIndex(final Class clazz,
+                               final String name) throws IntrospectionException {
+        final PropertyDescriptor[] descriptors = Introspector.getBeanInfo( clazz ).getPropertyDescriptors();
+        for ( int i = 0; i < descriptors.length; i++ ) {
+            if ( descriptors[i].getName().equals( name ) ) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    public char getCharType() {
+        return charType;
+    }
+
+    public void setCharType(char charType) {
+        this.charType = charType;
+    }
+}
\ No newline at end of file

Added: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/CheeseInterface.java
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/CheeseInterface.java	                        (rev 0)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/CheeseInterface.java	2010-08-19 22:44:42 UTC (rev 34804)
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.drools;
+
+public interface CheeseInterface {
+
+    public String getType();
+
+    public int getPrice();
+
+    /**
+     * @param price the price to set
+     */
+    public void setPrice(final int price);
+
+    /**
+     * @param type the type to set
+     */
+    public void setType(final String type);
+
+}
\ No newline at end of file


Property changes on: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/java/org/drools/CheeseInterface.java
___________________________________________________________________
Name: svn:executable
   + *

Modified: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/META-INF/persistence.xml
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/META-INF/persistence.xml	2010-08-19 21:34:35 UTC (rev 34803)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/META-INF/persistence.xml	2010-08-19 22:44:42 UTC (rev 34804)
@@ -25,7 +25,7 @@
 	        <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>	        
 	        <property name="hibernate.max_fetch_depth" value="3"/>
 		    <property name="hibernate.hbm2ddl.auto" value="update" />
-            <property name="hibernate.show_sql" value="true" />	
+            <property name="hibernate.show_sql" value="false" />	
             <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.BTMTransactionManagerLookup" />
 	    </properties>        
     </persistence-unit>

Modified: labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/log4j.xml
===================================================================
--- labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/log4j.xml	2010-08-19 21:34:35 UTC (rev 34803)
+++ labs/jbossrules/branches/5_1_20100802_esteban_diega/drools-persistence-jpa/src/test/resources/log4j.xml	2010-08-19 22:44:42 UTC (rev 34804)
@@ -8,13 +8,16 @@
 		</layout>
 	</appender>
 
-	<logger name="org.drools">
-		<level value="INFO"/>
+    <logger name="org.drools.persistence.session.SingleSessionCommandService">
+      <level value="DEBUG"/>
+    </logger>
+    <logger name="bitronix.tm">
+      <level value="ERROR"/>
+    </logger>
+	
+	<logger name="org.hibernate">
+		<level value="FATAL"/>
 	</logger>
-	
-	<!-- logger name="org.hibernate">
-		<level value="INFO"/>
-	</logger -->
 	<root>
 		<priority value="INFO"/>
 		<appender-ref ref="CONSOLE"/>



More information about the jboss-svn-commits mailing list