Skip to content

Instantly share code, notes, and snippets.

View leonardocregis's full-sized avatar

Leonardo leonardocregis

  • Rio de Janeiro
View GitHub Profile
@leonardocregis
leonardocregis / Google Cloud - Maven Plugin Commands
Last active December 8, 2015 17:57
Direct List of Maven Plugins Commands to be called by the mvn
#Maven
#local
mvn appengine:deploy
#enviando p google, remember to copy the key that google sends and use it into the console
mvn appengine:update
#if something goes wrong, use this below, usually its a synchro error stuff
mvn appengine:rollback
@Enpoint
#Declaration of a endpoint
@ApiMethod(name = "getConferencesCreated", path = "getConferencesCreated", httpMethod = HttpMethod.POST)
#Declaration of a attribute to be set as a entry on the endpoint
public void setName(@Name(value="name of Atribute to be show") String atribute);
@leonardocregis
leonardocregis / Google Cloud - Email Implementation
Created December 8, 2015 22:07
Sample of calling the email implementation for Google Cloud
import com.google.appengine.api.utils.SystemProperty;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
try {
Message message = new MimeMessage(session);
InternetAddress from = new InternetAddress(
filename:src/main/webapp/WEB-INF/queue.xml
<queue-entries>
<queue>
<name>emailqueue</name>
<rate>1/s</rate>
</queue>
</queue-entries>
calling it:
Queue queue = QueueFactory.getDefaultQueue();
1- define a cron into the path/file /main/webapp/WEB-INF/cron.xml
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/daily_report</url>
<description>Mail out a daily report</description>
<schedule>every day 00:00</schedule>
</cron>
<cron>
<url>/weekly_report</url>
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @Author leonardocregis
*/
public class LineReplacer implements Filter<String> {
Example for debug configurations
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044
@leonardocregis
leonardocregis / Testing - Path manager
Created December 14, 2015 17:12
A way to define better the path of the resources into a test
static {
dir = System.getProperty("user.dir") + "/src/test/resources/queue.xml";
}
@leonardocregis
leonardocregis / Google Cloud - Fixing Unit Test
Created December 17, 2015 16:15
Import to be put into test if ui are going to use some Xml parser
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-tools-sdk</artifactId>
<version>${gae.version}</version>
</dependency>
#commandos do vi
:wq! (para salvar e sair)