[appengine-java] How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
Prior to version 2.01 I was able to get testing to work with other
queues by the following code:

LocalTaskQueue ltq = 
LocalTaskQueueTestConfig.getLocalTaskQueue();


LocalServiceContext ctx = new LocalServiceContext() {
public File getAppDir() {
Logger.getAnonymousLogger().info(trying to run
getAppDir());
File file = new File(war);
return file;
}
};

HashMapString,String prop = new HashMapString,String();
ltq.init(ctx, prop);
ltq.start();

You had to tell it where to find the config file queue.xml.  Now after
upgrading and using

private static LocalServiceTestHelper helper =
new LocalServiceTestHelper(new LocalTaskQueueTestConfig());

along with: helper.setUp

I am getting the old testing errors of:
java.lang.IllegalStateException: The specified queue is unknown :

How do I get the Queue environment to recognize the queues in the
queue.xml file?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
Actually it doesn't seem to be reading the queue at all.  It is coming
from the standard directory in WAR, but doesn't seem to pick it up.  I
am on Mac OS if that makes any difference.

On Feb 16, 9:35 am, Max Ross (Google) maxr+appeng...@google.com
wrote:
 Hi Will,

 You're loading queue.xml from a different location in your unit tests?  This
 is a use case I didn't thoroughly consider.  I can certainly fix this for
 the next release but let me see if I can find a workaround for you.

 Thanks,
 Max


-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
This  workaround works, all I have to do is give it:

return new File(war);

and it finds the queue.xml file.  Is there another location other than
the war/WEB-INF/queue.xml the file is supposed to be in?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
I am saying that it is not reading queue.xml.  I am testing to make
sure a certain function puts x number tasks in a queue that is not
the default.  It doesn't load the queue.xml file unless I use your
workaround (then it works great.)

On Feb 16, 10:21 am, Max Ross (Google) maxr+appeng...@google.com
wrote:
 By default the LocalTaskQueueTestConfig configures the local task queue
 service to not automatically execute 
 tasks:http://code.google.com/appengine/docs/java/tools/localunittesting/jav...

 Or are you saying it's not reading queue.xml?

 On Tue, Feb 16, 2010 at 10:16 AM, Will Bunker w...@thebunkers.com wrote:
  Actually it doesn't seem to be reading the queue at all.  It is coming
  from the standard directory in WAR, but doesn't seem to pick it up.  I
  am on Mac OS if that makes any difference.

  On Feb 16, 9:35 am, Max Ross (Google) 
  maxr+appeng...@google.commaxr%2bappeng...@google.com

  wrote:
   Hi Will,

   You're loading queue.xml from a different location in your unit tests?
   This
   is a use case I didn't thoroughly consider.  I can certainly fix this for
   the next release but let me see if I can find a workaround for you.

   Thanks,
   Max

  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine for Java group.
  To post to this group, send email to
  google-appengine-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
Is that the best expected behavior.  Should I have to remember to
move over a new copy of queue.xml if it changes in the war directory.
Or should it pick up the actual directory??  I am thinking of doing a
link on the file system as a workaround.  Thanks for your help.

On Feb 16, 10:47 am, Max Ross (Google) maxr+appeng...@google.com
wrote:
 I see.  In the test environment it looks in . by default so if you place
 queue.xml in the directory from which you're executing the test it should
 pick it up.

 On Tue, Feb 16, 2010 at 10:35 AM, Will Bunker w...@thebunkers.com wrote:
  I am saying that it is not reading queue.xml.  I am testing to make
  sure a certain function puts x number tasks in a queue that is not
  the default.  It doesn't load the queue.xml file unless I use your
  workaround (then it works great.)

  On Feb 16, 10:21 am, Max Ross (Google) 
  maxr+appeng...@google.commaxr%2bappeng...@google.com

  wrote:
   By default the LocalTaskQueueTestConfig configures the local task queue
   service to not automatically execute tasks:
 http://code.google.com/appengine/docs/java/tools/localunittesting/jav...

   Or are you saying it's not reading queue.xml?

   On Tue, Feb 16, 2010 at 10:16 AM, Will Bunker w...@thebunkers.com
  wrote:
Actually it doesn't seem to be reading the queue at all.  It is coming
from the standard directory in WAR, but doesn't seem to pick it up.  I
am on Mac OS if that makes any difference.

On Feb 16, 9:35 am, Max Ross (Google) 
maxr+appeng...@google.commaxr%2bappeng...@google.com
  maxr%2bappeng...@google.com maxr%252bappeng...@google.com

wrote:
 Hi Will,

 You're loading queue.xml from a different location in your unit
  tests?
 This
 is a use case I didn't thoroughly consider.  I can certainly fix this
  for
 the next release but let me see if I can find a workaround for you.

 Thanks,
 Max

--
You received this message because you are subscribed to the Google
  Groups
Google App Engine for Java group.
To post to this group, send email to
google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@googlegroups.com

.
For more options, visit this group at
   http://groups.google.com/group/google-appengine-java?hl=en.

  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine for Java group.
  To post to this group, send email to
  google-appengine-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: How to get testing working with anything other than the default queue

2010-02-16 Thread Will Bunker
I put in queue.xml in the test directory and it didn't seem to find
it.

On Feb 16, 10:47 am, Max Ross (Google) maxr+appeng...@google.com
wrote:
 I see.  In the test environment it looks in . by default so if you place
 queue.xml in the directory from which you're executing the test it should
 pick it up.I

 On Tue, Feb 16, 2010 at 10:35 AM, Will Bunker w...@thebunkers.com wrote:
  I am saying that it is not reading queue.xml.  I am testing to make
  sure a certain function puts x number tasks in a queue that is not
  the default.  It doesn't load the queue.xml file unless I use your
  workaround (then it works great.)

  On Feb 16, 10:21 am, Max Ross (Google) 
  maxr+appeng...@google.commaxr%2bappeng...@google.com

  wrote:
   By default the LocalTaskQueueTestConfig configures the local task queue
   service to not automatically execute tasks:
 http://code.google.com/appengine/docs/java/tools/localunittesting/jav...

   Or are you saying it's not reading queue.xml?

   On Tue, Feb 16, 2010 at 10:16 AM, Will Bunker w...@thebunkers.com
  wrote:
Actually it doesn't seem to be reading the queue at all.  It is coming
from the standard directory in WAR, but doesn't seem to pick it up.  I
am on Mac OS if that makes any difference.

On Feb 16, 9:35 am, Max Ross (Google) 
maxr+appeng...@google.commaxr%2bappeng...@google.com
  maxr%2bappeng...@google.com maxr%252bappeng...@google.com

wrote:
 Hi Will,

 You're loading queue.xml from a different location in your unit
  tests?
 This
 is a use case I didn't thoroughly consider.  I can certainly fix this
  for
 the next release but let me see if I can find a workaround for you.

 Thanks,
 Max

--
You received this message because you are subscribed to the Google
  Groups
Google App Engine for Java group.
To post to this group, send email to
google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to
google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  google-appengine-java%2bunsubscr...@googlegroups.comgoogle-appengine-java%252bunsubscr...@googlegroups.com

.
For more options, visit this group at
   http://groups.google.com/group/google-appengine-java?hl=en.

  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine for Java group.
  To post to this group, send email to
  google-appengine-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] How to get more than one Testing Environment going

2010-02-16 Thread Will Bunker
I have a section of code that uses both TaskQueue and Datastore
services.  I can get one or the other working with:

private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new
LocalDatastoreServiceTestConfig());

or

private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new LocalTaskQueueTestConfig());


how do I get both environments set up simultaneously so that my data
is cleared and queues are functioning?

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
I originally posted this on General discussion, not realizing there is
a Java specific group, so I am sorry for the redundancy:

I have gotten the basic setup recommended in the docs.  I am able to
query the database successfully but as soon as I attempt to persists a
JDO object I get a can't find annotations error.  The code is simply:

public class UserTestCase extends LocalDatastoreTestCase {

public void testDatesBeingSetOnCreate() {

User user = new User(w...@thebunkers.com, mypassword);

//DatastoreServiceFactory.getDatastoreService().put(user);

PersistenceManager manager = newPersistenceManager();
manager.makePersistent(user);
manager.close();

Query query = new Query(User.class.getSimpleName());
assertEquals(1, DatastoreServiceFactory.getDatastoreService
().prepare(query).countEntities());
}

}

The error occurs at the makePersistent call.  If I comment it out the
test runs fine except of course there is no user on the assert line.

The error is:

org.datanucleus.jdo.exceptions.NoPersistenceInformationException: The
class The class com.sootra.shared.User is required to be
persistable yet no Meta-Data/Annotations can be found for this class.
Please check that the Meta-Data/annotations is defined in a valid file
location. is required to be persistable yet no Meta-Data can be found
for this class. Please check that the Meta-Data is defined in a valid
file location for JDO.

I am able to run the create user fine when running the app locally, as
well as uploading it to app engine.  So the code is fine, but I am
unable to get JUnit test to recognize where the MetaData is being
created by the enhancer.

Has anyone successfully gotten this to run in Eclipse.  I am guessing
that I am missing some classpath setting or meta information, but can
not find any references anywhere on the net yet.

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
Also turned on logging of the  Datanucleus to the finest level and am
getting the following:


Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.rdbms.sql.allowAllSQLStatements unknown -
will be ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.rdbms.stringDefaultLength unknown - will be
ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.appengine.autoCreateDatastoreTxns unknown -
will be ignored
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: = Persistence Configuration ===
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: DataNucleus Persistence Factory - Vendor: DataNucleus
Version: 1.1.5
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: DataNucleus Persistence Factory initialised for datastore
URL=appengine driver= userName=
Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
logConfiguration
INFO: ===
Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
setProperty
INFO: Property datanucleus.query.cached unknown - will be ignored
Jan 27, 2010 2:00:08 PM
org.datanucleus.jdo.metadata.JDOMetaDataManager init
INFO: Registering listener for metadata initialisation
Jan 27, 2010 2:00:08 PM org.datanucleus.jdo.metadata.JDOMetaDataManager
$MetaDataRegisterClassListener registerClass
INFO: Listener found initialisation for persistable class
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM
org.datanucleus.jdo.metadata.JDOAnnotationReader
processClassAnnotations
INFO: Class com.sootra.shared.User has been specified with JDO
annotations so using those.
Jan 27, 2010 2:00:08 PM
org.datanucleus.store.appengine.MetaDataValidator validate
INFO: Performing appengine-specific metadata validation for
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM
org.datanucleus.store.appengine.MetaDataValidator validate
INFO: Finished performing appengine-specific metadata validation for
com.sootra.shared.User
Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
registerStoreData
INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
(none), InheritanceStrategy : subclass-table]
Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
registerStoreData
INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
(none), InheritanceStrategy : subclass-table]

So it seems to be running the metadata validation but then can't find
the enhanced information???

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
 void setCreate_date(Date createDate) {
create_date = createDate;
}

public Date getUpdate_time() {
return update_time;
}

public void setUpdate_time(Date updateTime) {
update_time = updateTime;
}

public Date getUpdate_date() {
return update_date;
}

public void setUpdate_date(Date updateDate) {
update_date = updateDate;
}

public String getUser_type() {
return user_type;
}

public void setUser_type(String userType) {
user_type = userType;
}


}


On Jan 27, 2:08 pm, Ikai L (Google) ika...@google.com wrote:
 Any chance you can post the User class and the method definition for
 newPersistenceManager()?



 On Wed, Jan 27, 2010 at 2:04 PM, Will Bunker w...@thebunkers.com wrote:
  Also turned on logging of the  Datanucleus to the finest level and am
  getting the following:

  Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
  setProperty
  INFO: Property datanucleus.rdbms.sql.allowAllSQLStatements unknown -
  will be ignored
  Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
  setProperty
  INFO: Property datanucleus.rdbms.stringDefaultLength unknown - will be
  ignored
  Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
  setProperty
  INFO: Property datanucleus.appengine.autoCreateDatastoreTxns unknown -
  will be ignored
  Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
  logConfiguration
  INFO: = Persistence Configuration ===
  Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
  logConfiguration
  INFO: DataNucleus Persistence Factory - Vendor: DataNucleus
  Version: 1.1.5
  Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
  logConfiguration
  INFO: DataNucleus Persistence Factory initialised for datastore
  URL=appengine driver= userName=
  Jan 27, 2010 2:00:08 PM org.datanucleus.ObjectManagerFactoryImpl
  logConfiguration
  INFO: ===
  Jan 27, 2010 2:00:08 PM org.datanucleus.PersistenceConfiguration
  setProperty
  INFO: Property datanucleus.query.cached unknown - will be ignored
  Jan 27, 2010 2:00:08 PM
  org.datanucleus.jdo.metadata.JDOMetaDataManager init
  INFO: Registering listener for metadata initialisation
  Jan 27, 2010 2:00:08 PM org.datanucleus.jdo.metadata.JDOMetaDataManager
  $MetaDataRegisterClassListener registerClass
  INFO: Listener found initialisation for persistable class
  com.sootra.shared.User
  Jan 27, 2010 2:00:08 PM
  org.datanucleus.jdo.metadata.JDOAnnotationReader
  processClassAnnotations
  INFO: Class com.sootra.shared.User has been specified with JDO
  annotations so using those.
  Jan 27, 2010 2:00:08 PM
  org.datanucleus.store.appengine.MetaDataValidator validate
  INFO: Performing appengine-specific metadata validation for
  com.sootra.shared.User
  Jan 27, 2010 2:00:08 PM
  org.datanucleus.store.appengine.MetaDataValidator validate
  INFO: Finished performing appengine-specific metadata validation for
  com.sootra.shared.User
  Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
  registerStoreData
  INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
  (none), InheritanceStrategy : subclass-table]
  Jan 27, 2010 2:00:08 PM org.datanucleus.store.StoreDataManager
  registerStoreData
  INFO: Managing Persistence of Class : com.sootra.shared.User [Table :
  (none), InheritanceStrategy : subclass-table]

  So it seems to be running the metadata validation but then can't find
  the enhanced information???

  --
  You received this message because you are subscribed to the Google Groups
  Google App Engine for Java group.
  To post to this group, send email to
  google-appengine-j...@googlegroups.com.
  To unsubscribe from this group, send email to
  google-appengine-java+unsubscr...@googlegroups.comgoogle-appengine-java%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/google-appengine-java?hl=en.

 --
 Ikai Lan
 Developer Programs Engineer, Google App 
 Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
I was wrong with my initial analysis.  I had assumed because a
subclass was persisting that the super class would also.  When I try
and add a User I get the meta/data missing also in local environment.

I have narrowed it down to one line which triggers the problem:

@Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
public class User implements PersistHooks {


when I take out the @Inheritance then it finds the meta-data for the
user class.  Is this a feature or a bug??

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.



[appengine-java] Re: Can't get JUnit to test making a JDO object persistent

2010-01-27 Thread Will Bunker
Realize that I totally misunderstood the @inheritance properties.  I
was assuming that all subclasses would be store in super class, but
realize that it is the opposite.  So there is no actual meta data
being generated for the user table, but all the fields are put in the
metadata for subclass.

On Jan 27, 3:40 pm, Will Bunker w...@thebunkers.com wrote:
 I was wrong with my initial analysis.  I had assumed because a
 subclass was persisting that the super class would also.  When I try
 and add a User I get the meta/data missing also in local environment.

 I have narrowed it down to one line which triggers the problem:

 @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE)
 public class User implements PersistHooks {

 when I take out the @Inheritance then it finds the meta-data for the
 user class.  Is this a feature or a bug??

-- 
You received this message because you are subscribed to the Google Groups 
Google App Engine for Java group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.