コード例 #1
0
  @Test
  public void process_linksUsagePointAndMeterReading() {
    entry.getContent().setReadingType(new ReadingType());

    EntryType entryType = processor.process(entry);

    assertThat(entryType.getContent().getResource().getId(), is(notNullValue()));
  }
コード例 #2
0
  @Test
  public void process_givenLocatTimeParametersEntry() {
    entry.getContent().setLocalTimeParameters(new TimeConfiguration());

    EntryType entryType = processor.process(entry);

    assertThat(entryType.getContent().getResource().getId(), is(notNullValue()));
  }
コード例 #3
0
  @Test
  public void process_givenUsagePointEntry() {
    UsagePoint usagePoint = new UsagePoint();
    usagePoint.setServiceCategory(new ServiceCategory(ServiceCategory.ELECTRICITY_SERVICE));
    entry.getContent().setUsagePoint(usagePoint);

    EntryType entryType = processor.process(entry);

    assertThat(entryType.getContent().getResource().getId(), is(notNullValue()));
  }
コード例 #4
0
  @Before
  public void before() throws Exception {
    processor = new EntryProcessor(linker, new ResourceConverter(), resourceService);

    entry = new EntryType();
    entry.setId("urn:uuid:F77FBF34-A09E-4EBC-9606-FF1A59A17CAE");
    entry.setTitle("title");
    entry.setPublished(ATOMFactory.newDateTimeType());
    entry.setUpdated(ATOMFactory.newDateTimeType());
    entry.getLinks().add(new LinkType(LinkType.RELATED, "related"));
    entry.getLinks().add(new LinkType(LinkType.SELF, "self"));
    entry.getLinks().add(new LinkType(LinkType.UP, "up"));
  }
コード例 #5
0
  private String newXML(IdentifiedObject resource)
      throws DatatypeConfigurationException, FeedException {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    EntryType entry = new EntryType();
    entry.getLinks().add(new LinkType(LinkType.SELF, "self"));
    entry.setTitle("entry");
    entry.setId("id");
    entry.setPublished(new DateTimeType());
    entry.setUpdated(new DateTimeType());
    ContentType content = new ContentType();
    content.setResources(Lists.<IdentifiedObject>newArrayList(resource));
    entry.setContent(content);

    fragmentMarshaller.marshal(entry, new StreamResult(os));

    return os.toString();
  }