Coder Social home page Coder Social logo

scala-jruby-activerecord's People

Contributors

drsquidop avatar ngocdaothanh avatar

Stargazers

 avatar

Watchers

 avatar  avatar

scala-jruby-activerecord's Issues

Review test results

Hi Ngoc,

Thank you for the pull request! Excellent work. Please review the test results below.

PASS - 39
OK - 4 - accepted with comment (see below)
FAIL - 0

We are accepting this pull request and payment is being made.

Please respond to this ticket with how the process worked for you; any recommendations; and whether you recommend the JSR or another interface for communicating with the jruby model.

Thanks again!

Doug

Description

A program that demonstrates a Scala program calling a standard JRuby/Rails ActiveRecord model object which uses a postgres database. Implement unit tests on the scala program to test the functionality. The calling interface will be the java JSR 223 Scripting API’s.

Requirements

  1. Submission
    1. Work will start by forking the project
      1. post any questions as issues here
    2. Submit work by issuing a git pull request
    3. Requirements can be verified by following these steps on a test machine:
      1. install software prerequisites
      2. do a git clone/git pull
        PASS
      3. (optionally) creating an empty database
        PASS
      4. running ‘sbt publish-local’ or ‘mvn install’ to run all tests
        OK - necessary to run multiple steps to do the tests. But looks very good otherwise!
      5. inspecting the code
        PASS
    4. Submission is accepted by accepting the pull request
    5. Submission is rejected by opening a ticket in the developers fork on github
  2. Supported platforms
    1. Either of Apple OSX 10.8.2 or Ubuntu 12.04.3 LTS
  3. Software Versions
    1. Maven 3.0.3 or higher (if used)
    2. Java 1.7.0_x (Oracle java SE)
    3. Jruby 1.7.3 or higher
    4. Rails 4.0.1 or higher
    5. SBT 0.13.0 or higher
    6. Scala 2.10.2 or higher
    7. Postgresql 9.2.2.0 or higher
  4. Software Prerequisites
    1. Assume that the above software versions are already installed on the test machine
    2. Assume the default ‘empty’ postgresql user
  5. Directory Structure
    scala-jruby-activerecord/ .gitignore README.md pom.xml or sbt project/ (to build,test,package the whole project) model-gem/ (a gem following the ‘bundle gem’ convention) scala-client/ (a scala project following sbt or maven convention) .../resources/ config.__ - a config file holding the db credentials
    OK - configuration should be externalized as a properties or other config file in scala
  6. Packaging
    1. Project will package as:
      1. com.drsquidop.scala-jruby-activerecord:model-gem-1.0.SNAPSHOT:jar
        1. this gem will package as both a gem and a jar
          PASS
      2. com.drsquidop.scala-jruby-activerecord:scala-client-1.0.SNAPSHOT:jar
        1. this jar will include a dependency on the model-gem jar
          PASS
  7. General Requirements
    1. scala-client
      1. based on scala 2.10 maven or sbt convention
        PASS
      2. depends on model-gem jar
        PASS
      3. calls model-gem using JSR 223 Scripting API (see references)
        PASS
      4. passes database configuration to model-gem
        PASS
      5. contains MyModel case class with these fields
        1. id: Option[Int]
          PASS
        2. name: String
          PASS
      6. contains Client object with these methods
        1. new(MyModel): Try[MyModel] - returns with assigned id
          PASS
        2. get(id:Int): Try[MyModel] - returns record with id
          PASS
        3. all(): Try[List[MyModel]] - returns all records
          PASS
      7. contains ValidationException extends Exception that contains ActiveRecord generated validation errors
        PASS
    2. model-gem
      1. based on ‘bundle gem ’ convention
        PASS
      2. based on rails ActiveRecord model object convention
        PASS
      3. passed its database configuration from scala-client
        PASS
      4. contains MyGemModel ActiveRecord object with
        1. id - autoassigned pk
          PASS
        2. name - string
          PASS
      5. ‘mvn package’ (or shell script) handles
        1. reloading db from migrations
          PASS
        2. running rspec
          PASS
        3. packaging as gem
          PASS
        4. packaging as jar
          PASS
        5. deploying jar to local repo
          PASS
  8. Tests
    1. Scala tests will use ScalaTest or Specs2
    2. Unit Tests
      1. model-gem
        1. Configuration
          1. tests are implemented in rspec
            PASS
          2. database configuration comes from gem/config/database.yml
            PASS
        2. Test cases
          1. MyGemModel.new with (any string) creates a record in the database
            OK - should verify that the record was actually created
          2. MyGemModel.new with (blank string) returns rails standard validation error
            PASS
          3. MyGemModel.get(id) returns a valid object
            PASS
          4. MyGemModel.all returns multiple entries
            OK - but should return multiple entries
      2. scala-client
        1. Configuration
          1. model-gem is packaged as a jar
            PASS
          2. scala-client includes model-gem jar as dependency
          3. tests run under scala-client using mvn or sbt
            PASS
          4. tests are written in scalatest or specs2
            PASS
          5. database config comes from scala-client/...config file
            OK - config should allow read from external file
        2. Test cases
          1. Client.new(any string) returns Success(MyModel)
            PASS
          2. Client.new(empty string) returns Failure(ValidationException) with ActiveRecord validation error map
            PASS
          3. Client.get(valid id) returns Success(MyModel)
            PASS
          4. Client.get(invalid id) returns Failure(Exception("MyModel not found"))
            PASS
          5. Client.all returns Success(List[MyModel]) with several records
            PASS

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.