Examples of EntryService


Examples of com.apress.prospring3.springblog.service.EntryService

    ctx.load("classpath:mybatis-app-context.xml");
    ctx.refresh();
   
    System.out.println("App context initialized successfully");   
   
    EntryService entryService = ctx.getBean("entryService", EntryService.class);
   
    List<Entry> entries = entryService.findByCategoryId("Spring");
   
    for (Entry entry: entries) {
      System.out.println(entry);
   
   
    System.out.println("Finding entry with id 1");
    Entry entry = entryService.findById(1l);
    System.out.println(entry)
   
    // insert entry
    entry = new Entry();
    entry.setSubject("Testing entry clarence");
    entry.setBody("Testing entry clarence");
    entry.setPostDate(new DateTime());
    entry.setCategoryId("Spring");
    entry.setCreatedBy("clarence");
    DateTime currentDateTime = new DateTime();
    entry.setCreatedDate(currentDateTime);
    entry.setLastModifiedBy("clarence");
    entry.setLastModifiedDate(currentDateTime);
    entryService.save(entry);
    System.out.println("New entry insert successfully");
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
    }
   
    // Delete entry
    System.out.println("Deleting entry with id 2");
    entry = entryService.findById(2l);
    entryService.delete(entry);
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
   
   
    // Update entry
    System.out.println("Updating entry with id 1");
    entry = entryService.findById(1l);
    entry.setSubject("Updated entry subject crap");
    currentDateTime = new DateTime();
    entry.setLastModifiedDate(currentDateTime);
    entryService.save(entry);
    System.out.println("Entry updated successfully");
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
    }     
View Full Code Here

Examples of com.apress.prospring3.springblog.service.EntryService

    ctx.load("classpath:jpa-app-context.xml");
    ctx.refresh();
   
    System.out.println("App context initialized successfully");
   
    EntryService entryService = ctx.getBean("entryService", EntryService.class);
   
    PageRequest pageRequest = new PageRequest(0, 10);

    String subject = "%";
    String categoryId = "Spring";
    DateTime fromPostDate = DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime("1900-01-01");
    DateTime toPostDate = DateTimeFormat.forPattern("yyyy-MM-dd").parseDateTime("2011-12-18");
   
    SearchCriteria searchCriteria = new SearchCriteria();
    searchCriteria.setSubject(subject);
    searchCriteria.setCategoryId(categoryId);
    searchCriteria.setFromPostDate(fromPostDate);
    searchCriteria.setToPostDate(toPostDate);
   
    Page<Entry> entries = entryService.findEntryByCriteria(searchCriteria, pageRequest);
    System.out.println("No. of entries:" + entries.getNumberOfElements());
   
    //Page<Entry> entries = entryService.findAllByPage(pageRequest);
    //System.out.println("No. of entries:" + entries.getNumberOfElements());
   
View Full Code Here

Examples of com.apress.prospring3.springblog.service.EntryService

    ctx.load("classpath:jpa-app-context.xml");
    ctx.refresh();
   
    System.out.println("App context initialized successfully");
   
    EntryService entryService = ctx.getBean("entryService", EntryService.class);
   
    List<Entry> entries = entryService.findByCategoryId("Spring");
   
    for (Entry entry: entries) {
      System.out.println(entry);
    }
   
    System.out.println("Finding entry with id 1");
    Entry entry = entryService.findById(1l);
    System.out.println(entry);
   
    // insert entry
    entry = new Entry();
    //entry.setSubject("Testing entry clarence");
    entry.setSubject("Testing");
    entry.setBody("Testing entry clarence");
    entry.setPostDate(new DateTime());
    entry.setCategoryId("Spring");
    entryService.save(entry);
    System.out.println("New entry insert successfully");
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
    }   
   
    // Delete entry
    System.out.println("Deleting entry with id 2");
    entry = entryService.findById(2l);
    entryService.delete(entry);
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
   
   
    // Update entry
    System.out.println("Updating entry with id 1");
    entry = entryService.findById(1l);
    entry.setSubject("Updated entry subject crap");
    entryService.save(entry);
    System.out.println("Entry updated successfully");
   
        entries = entryService.findByCategoryId("Spring");
   
    for (Entry entryTemp: entries) {
      System.out.println(entryTemp);
      for (EntryAttachment attachment: entryTemp.getAttachments()) {
        System.out.println(attachment);
View Full Code Here

Examples of com.apress.prospring3.springblog.service.EntryService

    ctx.load("classpath:mybatis-app-context.xml");
    ctx.refresh();
   
    System.out.println("App context initialized successfully");   
   
    EntryService entryService = ctx.getBean("entryService", EntryService.class);
   
    List<Entry> entries = entryService.findAll();
   
    //System.err.println("Size: " + entries.size());
    for (Entry entry: entries) System.out.println("Entry: " + entry);

  }
View Full Code Here

Examples of com.jdkcn.myblog.service.EntryService

public class EntriesPageTest {

  @Test
  public void testEntriesPage() throws Exception {

    EntryService entryServiceMock = EasyMock.createMock(EntryServiceImpl.class);

    List<Entry> list = new LinkedList<Entry>();
    list.add(new Entry());
    Capture<Range> captureRange = new Capture<Range>();

    PaginationSupport<Entry> ps = new PaginationSupport<Entry>(list, list.size());
    expect(entryServiceMock.search(EasyMock.anyObject(Condition.class), EasyMock.capture(captureRange), EasyMock.anyObject(Sorter.class))).andReturn(ps)
        .once();

    Entries entries = new Entries(entryServiceMock);

    replay(entryServiceMock);
View Full Code Here

Examples of com.jdkcn.myblog.service.EntryService

  }
 
  @Test
  public void testEntriesPageSearch() throws Exception {
   
    EntryService entryServiceMock = EasyMock.createMock(EntryServiceImpl.class);
   
    List<Entry> list = new LinkedList<Entry>();
    list.add(new Entry());
    Capture<Range> captureRange = new Capture<Range>();
   
    PaginationSupport<Entry> ps = new PaginationSupport<Entry>(list, list.size());
    expect(entryServiceMock.search(EasyMock.anyObject(Condition.class), EasyMock.capture(captureRange), EasyMock.anyObject(Sorter.class))).andReturn(ps)
    .once();
   
    Entries entries = new Entries(entryServiceMock);
    entries.setP(2);
    entries.setSize(5);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.