This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| import grails.test.* | |
| class VisitaUnitTest extends GrailsUnitTestCase { | |
| protected void setUp() { | |
| super.setUp(); | |
| } | |
| protected void tearDown() { | |
| super.tearDown(); |
| {"persona": | |
| {"nombre":"paco","apellidos":"garcia garcia", "edad":"19", | |
| "direccion": | |
| {"calle":"mi calle", "numero":"28", "cp":"10001", "localidad":"Caceres"} | |
| } | |
| } |
| <entidad> | |
| <persona> | |
| <nombre>Paco</nombre> | |
| <apellidos>Garcia Garcia</apellidos> | |
| <edad>19</edad> | |
| <direccion> | |
| <calle>mi calle</calle> | |
| <numero>28</numero> | |
| <cp>10001</cp> | |
| <localidad>Caceres</localidad> |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
| /* ==================================================================== | |
| Licensed to the Apache Software Foundation (ASF) under one or more | |
| contributor license agreements. See the NOTICE file distributed with | |
| this work for additional information regarding copyright ownership. | |
| The ASF licenses this file to You under the Apache License, Version 2.0 | |
| (the "License"); you may not use this file except in compliance with | |
| the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 |
| db.zips.aggregate([{$match:{$or:[{state:"CA"}, {state:"NY"}]}}, {$group:{_id:{state:"$state", city:"$city"}, total_pop:{$sum:"$pop"}}}, {$match:{total_pop:{$gt:25000}}}, {$group:{_id:null, avg_pop:{$avg:"$total_pop"}}}]) |
| db.grades.aggregate([{$unwind:"$scores"}, {$match:{$or:[{"scores.type":"homework"}, {"scores.type":"exam"}]}}, {$group:{_id:{student_id:"$student_id", class_id:"$class_id"}, avg_score:{$avg:"$scores.score"}}}, {$group:{_id:"$_id.class_id", avg_score_class:{$avg:"$avg_score"}}}, {$sort:{avg_score_class:1}}]) |
| db.zips.aggregate([{$project:{first_char: {$substr: ["$city", 0, 1]}, pop:1, _id:0}}, {$match:{first_char:{$lte:'9'}}}, {$group:{_id:null, total:{$sum:"$pop"}}}]) |
| public class Prueba { | |
| public class Padre { | |
| } | |
| public class Hija extends Padre { | |
| @Override | |
| public String toString() { |
| @RunWith(Suite.class) | |
| @SuiteClasses({ MyTestClass.class }) | |
| public class JettyServerRESTTestSuite { | |
| private static final String APP_NAME = "/context"; | |
| private static final int PORT = 4141; | |
| public static final String APP_SERVER_ADDRESS = "http://localhost:" + PORT + APP_NAME + "/rest" + APP_NAME; | |
| private static Server server; | |