View ControllerTest.groovy
import spock.lang.Specification
/**
* Unit tests for {@link Controller}
*/
class ControllerTest extends Specification {
private static final String USERNAME = 'Duggie'
private static final String EMAIL = 'Duggie@test.com'
View spring-hateoas-demo_pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cor</groupId>
<artifactId>spring-hateoas-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>spring-hateoas-demo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
View spring-hateoas-demo_MusicService.java
package com.cor.service;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Service;
import com.cor.domain.Album;
import com.cor.domain.Artist;
/**
View spring-hateoas-demo-Artist.java
package com.cor.domain;
/**
* Music Artist/Group.
*
*/
public class Artist {
private final String id;
private final String name;
View spring-hateoas-demo_Album.java
package com.cor.domain;
/**
* Album (available to purchase - hence 'stockLevel' attribute).
*
*/
public class Album {
private final String id;
private final String title;
View spring-hateaos-demo-ArtistController.java
package com.cor.controller;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Resource;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
View spring-hateaos-demo_AlbumController.java
package com.cor.controller;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.methodOn;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.hateoas.Resource;
import org.springframework.http.MediaType;
View spring-hateoas-demo_Application.java
package com.cor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
/**
* Spring Boot launch file.
*/
@ComponentScan
View Oracle XML Query Example
SELECT ID, NAME
XMLTYPE(u.accountxml).EXTRACT('/person/account/sortCode/text()') as SORTCODE
FROM USER u;
View library_build_script.js
print("Starting MongoDB Library Database Build Script")
print("Creating Libary Database")
var libraryDB = db.getSiblingDB("library")
print("Creating Book Collection")
libraryDB.createCollection("book")
print("Creating index on 'type' field")
libraryDB.book.ensureIndex({type:1})