Skip to content

Instantly share code, notes, and snippets.

View mlesikov's full-sized avatar
😀

Mihail Lesikov mlesikov

😀
View GitHub Profile
@mlesikov
mlesikov / gist:934491
Created April 21, 2011 13:40
Contract field updates example 1
package com.evo.adm;
import com.opengrapes.common.widgets.util.Lists;
import org.junit.Test;
import java.util.List;
import static junit.framework.Assert.assertEquals;
/**
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskQueuePb;
import com.google.appengine.api.taskqueue.dev.LocalTaskQueueCallback;
import com.google.appengine.api.urlfetch.URLFetchServicePb;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig;
import com.google.apphosting.api.ApiProxy;
import org.junit.After;
@mlesikov
mlesikov / gist:1035215
Created June 20, 2011 06:41
GWT request factory twig locator
/**
* Objects implementing this interface can be located by {@link TwigEntityLocator}.
*/
public interface Entity {
/**
* Gets object id.
*
* @return object id.
*/
Long getId();
@mlesikov
mlesikov / gist:1559323
Created January 4, 2012 09:37
JDBC task
package com.mlesikov.peopletripproper;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@mlesikov
mlesikov / gist:1670034
Created January 24, 2012 12:42
push and delete remote branches
http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html
public class ChangeLoggers {
public static <T> T create(Class<? extends ChangeLogger> clazz, final CurrentUser currentUser, final ChangeLogBase base) {
return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[]{clazz}, new InvocationHandler() {
public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
Annotation[][] annotations = method.getParameterAnnotations();
/**
* @author Adelin Ghanayem [email protected]
*/
public class SitebricksReplyAssertion {
public static <T> void assertIsRepliedWith(Reply<T> reply, T expected) {
assertFieldValue("entity", reply, expected);
}
public static <T> void assertThatReplyStatusIs(Reply<T> reply, int expected) {
@mlesikov
mlesikov / FieldsSchema
Created September 1, 2014 06:21
FieldsSchema builder
/**
* @author Mihail Lesikov ([email protected])
*/
public class FieldsSchema {
public static Builder aNewFieldSchema() {
return new Builder();
}
public static class Builder {
/**
* @author Mihail Lesikov ([email protected])
*/
public class CsvBuilder {
private final StringBuilder sb;
private String separator = ",";
private String end = "\n";
private static final String NONE = "N/A";
private static final String ZERO = "0";
package com.google.sitebricks.persist;
/**
* Persister Service that manages an entire data store or set of data
* stores as identified by an annotation.
*
* @author [email protected] (Dhanji R. Prasanna)
*/
public abstract class Persister {
public abstract void start();