does Django have something similar to spring web flow? - django

The purpose is to create a stateful web applications with controlled navigation.
There is a clear start and an end point.
The user must go through a set of screens in a specific order.
Once complete it shouldn't be possible to repeat a transaction accidentally.

Check the workflow section on django awesome packages list
django-flows looks like most close substitution for spring web flow.
But build-in django wizard forms a fairly lightweight and suitable for many basic cases.

didn't test that particular lib but it seems well suited for what you need:
http://code.google.com/p/django-stateful/

Related

Architect admin interface for single page app

I have a single page app built with emberjs with an a rails backend. Is it a common pattern to build an admin interface on rails serverside on a subdomain. What is the right approach for this?
Your question is vague but I will try to answer it my best. I have done this with a Node and a Go backend combined with Ember.js.
No, there is technically nothing to prevent you from doing a single page application for an admin interface.
Rails is a good choice for this, and generally you should stick with the backend framework/language you and your team master the most.
As for what would be the right approach, there is no magic recipes. Document your code, write test and follow best practices for the tools you are using.
One key element though will be the communication between your frontend and your backend. Ember chose to follow the JSON API specification (http://jsonapi.org/) and comes out of the box with an adapter to talk with these kind of API. Using such adapter will help you save a lot of time.
Here are some implementation of JSON API for Ruby : http://jsonapi.org/implementations/#server-libraries-ruby
One more thing about your frontend code structure. You haven't say how big your app will be. If it gets big, you may want to take the pod approach in ember-cli (http://ember-cli.com/user-guide/#pod-structure). It basically changes the structure of the code so it's easier to maintain a lot of files.

Using IoC container in a multi-site environment

I am setting up a architecture for a new project. For this project we are using Sitecore 7 CMS. As you may know, Sitecore supports a multi-site environement. This means that 1 IIS instance can be used for multiple sites because Sitecore resolves them to use the right code and content.
For this project I will have the following hierarchy:
Core (generic, site unspecific logic)
Website A
Website B
We should be able to add as many sites as we want. Every site has a Data, Business and Presentation layer.
I also want to use a IoC container such as Castle Windsor, Ninject or Unity. I want a generic container/kernel for the core and then I would like to be able to register class for specific sites. So the classes I register for Website A should not be resolved for Website B
In Unity I guess you could child containers. I did not find a good way to force the application to use the child container when the Sitecore Context meets a certain requirement.
In Ninject I found stuff on contextual bindings, named scopes and modules which I liked very much. I thought I create a NinjectModule with Contextual Bindings and on resolving I would check the context. I did not find a nice and generic way of doing this.
However, after hours of googling I did not find a good example or tutorial on how this could be achieved and how this should be done in the best way.
For now I do not have a preference for which framework I want to use.
Hope some one would shed some light for my problem so that I can make some progress.
Thanks in advance
Look in to Windsor's Handler Selectors. They're a nice solution to multi-tenant applications. Also, Mike Hadlow has a couple of posts about using Handler Selectors in a multi-tenant environment.
I resolved it by using Multi-tenancy in Autofac: https://code.google.com/p/autofac/wiki/MultitenantIntegration

BDD when testing a web service / API

I am still trying to totally understand BDD and I am facing some doubts.
From my little experience, I have been using it to automate user acceptance test and I would like to know if it's possible to use it to test a web API, without UI.
In the past I've used BDD using the given-when-then jargon and mapping the steps to UI interactions. I've done this with Specflow in ASP.NET or cucumber/capybara in ruby on rails.
So for example we could have scenarios like this:
Given I am in the home page
When I click login button
Then I should see the login page
The current project I am working at is different. We are implementing an API based in web service which would be consumed by different type of clients. Like an iphone app, android app and an asp based web client. So our main focus is based in the back-end and just that.
In this case, the tests can't be faced from the UI point of view. So our end-to-end tests are based in our service endpoints. We pass some input arguments to a service calls and check the outputs.
Can we do this using BDD? Is this right?
or maybe it would be better to use a different thing like FitNesse?
Hmm.. is using FitNesse doing BDD?
I think you can do what your writing about in BDD. I'm not sure if those 2 links about testing of webservices with SpecFlow will help you but take a look on them if you haven't seen it yet.
http://codedetective.blogspot.co.uk/2012/10/testing-webservices-with-specflow.html
http://www.creamdog.se/blog/2011/02/24/webservices-automated-tests-using-specflow-and-babelfish/
Have a look at Karate, web service testing framework by Intuit. It's recently being open sourced. It has the capability of handling API dealing with HTML, JSON, XML, GraphQL queries and is built on top on cucumber.
Simple intro here : https://medium.com/blueprint-by-intuit/karate-web-services-testing-made-simple-366e8eb5adc0#.qnpy5gagt

What's the best way to split a Grails application into web service(s) and a presentation?

I have a fairly conventional Grails application. It's monolithic; although it's somewhat split into plugins along functionality lines, it is built into a single war for deployment. Due to company architectural constraints, I need to consider isolating the app's persistence into a web service (or series of web services). What's the best approach to dividing a Grails application into a persistence service and a presentation application?
Put your domain classes in a Grails plugin, and have two distinct Grails applications, one for your web front-end and one for your web service. Both access the database directly, but code for persistence is not duplicated.
Here is a blog post that have some more details on how to realize that.
I don't have an out-of-the-box solution for your problem, and I don't believe there is one. I'll just explain the solution I use and what I would consider in your case.
In my organisation, our approach is to separate our applications in a Grails back-end and a front-end in Flex. The reason is that we have many ready-to-use Flex components that would take too much time to re-implement using pure web technologies, but here's not my point.
Creating a REST back-end in Grails is quick, as views are scaffolded when appropriate, controllers are straightforward, and input validation is greatly simplified by Domain constraints.
The drawback of this split is that definition of domain objects have to be duplicated in the front-end. You might includes objects validation in the front-end or not, but if you omit them, it will have an influence on UI responsiveness (requests to the REST back-end in AJAX calls for real-time validation to get the errors). At the end, our application is quite cumbersome because modifying objects in the back-end implies modification in the front-end. Furthermore, we do validation in both the front-end AND the back-end, and this code is not shared, so it must stay in phase and maintained at two places.
Our applications are split in a way that's similar to two completely distinct Grails applications that would share no code. A solution that would work in your case but is not what you are looking for, for sure.
In your case, I see two viable solutions for the web front-end:
use the Groovy REST client library to fetch and send back your domain objects directly from your controller. If needed, pack them in command objects that reflect your domain objects, so that you can share validation code with the back-end.
create some kind of REST GORM that replaces Hibernate with queries to your REST web service. You could look at the GORM for Mongo Plugin as an example of how to create such a GORM replacement.
I like the last idea, it would be a useful public plug-in. It doesn't exist yet, unfortunetly.

Web service testing framework with interface for business users

I'm looking for a web service testing framework that has a good built in text input / output gui. The point would be for business and other non developer users to be able to test requirements by using a simple gui that they could enter values into and see the results from the web service. I have seen lots of references on Stack Overflow and the web to great developer web service testing tool but a nice, built in, I/O gui is the key feature for me.
By web service testing I mean a tool that sends xml post requests over HTTP and tests the response.
I have been trying out fitnesse but to use it I need to cut out parts of the system and I very much want to do end to end testing. The way fitnesse displays its results is great but the wiki data entry is a bit clunky for business users imo.
We use FitNesse for the most part. The developers maintain a fixture that s the connector between your app and the FitNesse server. The business user can write the test cases in an wiki style. Works fine for us.
Rational Functional Tester was in the discussion too. However, I have never seen it, but would have met our requirements too.
You might want to look at the robot framework. It's a pretty decent testing library which makes it easy to test web services. There is also a library that integrates Selenium into the framework for front-end testing. Tests can be specified in a couple of plain text formats as well as in HTML tables. You also have the option to let users create test data in spreadsheets if you like, then save them in a tab-separated format.
Look at WebServiceStudio http://www.codeplex.com/WebserviceStudio
We use Concordion for business testing. It's very similar to Fitness but the input files are HTML files "executed" by JUnit.
If your web services don't take 500 parameters, a HTML table is a great way to define input values. I agree, there no UI (although a WYSIWYG HTML editor would do it) but the benefit is that your tests can be checked into Subversion (for example), executed regularly (read every night) and the result HTML files be published internally.
I found testing composite application in Netbeans very easy to use ...
As you requested in your question you can define an input XML and a desired output XML, and when you run the test you have a classic JUnit result like this :
alt text http://netbeans.org/images_www/articles/61/soa/ep-understand-trs/testpassed.png
Here you can find a good example:
Understanding the Travel Reservation Service
I use NetBeans 6.5.1 bundled wit GlassFish ESB 2.1 ... I'm not sure that this feature is supported in the newest NetBeans Versions