Posts by Stephen Moss

14 Oct 2010, 04:41
Generic-user-small

Stephen Moss (3 posts)

(from Agile Web Development with Rails (3rd edition) > JRuby/Eclipse Unit Test Issue)

I’m having issues trying to get the Depot Application (Task T) unit testing runnning using Eclipse Galileo / JRuby 1.2.0.9419p2 / Apache Derby 10.1.3.1

I’ve used the rake commands to create the depot test database and verified that the schema and tables exist. When trying to run the following test:

test "invalid_with_empty_attributes" do
  assert true
  #product = Product.new
  #assert !product.valid?
  #assert product.errors.invalid?(:title)
  #assert product.errors.invalid?(:description)
  #assert product.errors.invalid?(:price)
  #assert product.errors.invalid?(:image_url)
end

NOTE: I’ve commented out the assert statements to keep the test simple

I get the following error:

Exception: ActiveRecord::ActiveRecordError: Syntax error: Encountered “RESTART” at line 1, column 40.: ALTER TABLE line_items ALTER COLUMN id RESTART WITH 2053932786

Can anyone help?

28 Oct 2010, 05:07
Generic-user-small

Stephen Moss (3 posts)

(from Agile Web Development with Rails (3rd edition) > JRuby/Eclipse Unit Test Issue)

Figured it out. The Apache Derby version being used (10.1.3.1) was an older version that didn’t accept the ALTER COLUMN id RESTART syntax…

Tricky bit was I needed to overwrite the Derby jar files in the Aptana directories as these took predecence over the eclipse/plugins directory version of Derby I installed (10.6).

02 Mar 2011, 06:01
Generic-user-small

Stephen Moss (3 posts)

(from Code in the Cloud > Java User Authentication)

I’ve managed to get the Chat application in Java up and running. One thing I’m struggling to get up and running is the concept of authenticating a user using GWT/Java, i.e. detecting if someone is logged in and re-directing them to the login URL if they aren’t before posting a message. Also, how is a “Login” type function implemented on the HTML page?

At the moment I’m using a hack in the postMessage server method to set the user name to “Guest” if the user isn’t logged in. Is this something that you will be covering in a later version of the book, or is there some advice on how to get this to work?

3 posts