Skip to content

Instantly share code, notes, and snippets.

@katta
katta / CouchDB_Example_Comment.java
Created July 6, 2011 12:49
CouchDB_Example_Comment
@TypeDiscriminator("doc.documentType == 'Comment'")
public class Comment extends CouchEntity {
private String blogPostId;
private String notes;
/* getters and setters */
}
@katta
katta / CouchDB_Example_BlogPostIntegrationTest.java
Created July 6, 2011 12:52
CouchDB_Example_BlogPostIntegrationTest
public class BlogPostIntegrationTest extends SpringIntegrationTest {
@Autowired
private BlogPosts blogPosts;
@Test
public void shouldPersistWithChildren() {
BlogPost blogPost = new BlogPost();
blogPost.setName("the blog");
blogPosts.add(blogPost);
@katta
katta / CouchDB_Example_BlogPost.java
Created July 6, 2011 12:33
CouchDB_Example_BlogPost
@TypeDiscriminator("doc.documentType == 'BlogPost'")
public class BlogPost extends CouchEntity {
private String name;
@DocumentReferences(backReference="blogPostId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Set<Comment> comments = new HashSet<Comment>();
/* getters and setters */
}
@katta
katta / CouchDB_Example_BlogPostWithComment.java
Created July 6, 2011 12:51
CouchDB_Example_BlogPostWithComment
@TypeDiscriminator("doc.documentType == 'BlogPost'")
public class BlogPost extends CouchEntity {
private String name;
@DocumentReferences(backReference="blogPostId", fetch = FetchType.EAGER, cascade = CascadeType.ALL)
private Set<Comment> comments = new HashSet<Comment>();
/* getters and setters */
public void addComment(Comment comment) {
comment.setBlogPostId(this.getId());
@katta
katta / Jenkins_Growl_Notifier.rb
Created July 10, 2012 15:05
Growl notifier for jenkins
#!/usr/bin/ruby
require 'rubygems'
require 'json'
require 'net/http'
require 'uri'
require 'date'
$ciBaseUrl = 'http://ci.motechproject.org' #URL of your jenkins CI
$jobs = ['Ananya-Kilkari','Ananya-Reports','Ananya-Kilkari-Smoke'] # add all the jobs to be monitored in this list
@katta
katta / gist:3437976
Created August 23, 2012 15:58
Fakerest sample configuration file
---
method : get
path : /customer/:id
response:
content_file : customer
content_type : json
status_code : 200
---
method : post
path : /customer
@katta
katta / fakerest-readme.md
Created September 4, 2012 17:16
What is fakerest

Fakerest

Fakerest is a simple tool based on sinatra which starts a http server (webrick) and exposes restful services based on the configuration specified in a YAML format.

Features

You can :

  • Stub any of the restful servies be it any method GET, POST, HEAD, PUT etc.
  • Configure multiple URLs based on your need
@katta
katta / es-plugin.properties
Created December 21, 2012 11:11
Elastic Search plugin properties
plugin=org.katta.es.plugin.http.CustomRestHandlerPlugin
@katta
katta / CustomRestHandlerPlugin.java
Last active December 10, 2015 00:38
Plugin extension for elastic search
package org.katta.es.plugin.http;
import org.katta.es.http.RestRegisterAction;
import org.elasticsearch.plugins.AbstractPlugin;
import org.elasticsearch.rest.RestModule;
public class CustomRestHandlerPlugin extends AbstractPlugin {
@Override
public String name() {
@katta
katta / RestRegisterAction.java
Created December 21, 2012 11:37
Custom REST handler for Elastic Search
package org.katta.es.http;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.*;
public class RestRegisterAction extends BaseRestHandler {
@Inject