本文整理汇总了Java中com.google.gdata.data.sites.BaseContentEntry.setId方法的典型用法代码示例。如果您正苦于以下问题:Java BaseContentEntry.setId方法的具体用法?Java BaseContentEntry.setId怎么用?Java BaseContentEntry.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gdata.data.sites.BaseContentEntry
的用法示例。
在下文中一共展示了BaseContentEntry.setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testUpdateById
import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Test
public void testUpdateById() throws IOException, ServiceException {
final String id = feedUrl.toExternalForm() + "/entry";
final BaseContentEntry<?> newEntry = new WebPageEntry();
newEntry.setId(id);
final BaseContentEntry<?> oldEntry = new WebPageEntry();
oldEntry.setId(id);
oldEntry.addLink(ILink.Rel.ENTRY_EDIT, ILink.Type.ATOM, id);
final BaseContentEntry<?> returnedEntry = new WebPageEntry();
returnedEntry.setId(id);
context.checking(new Expectations() {{
oneOf (sitesService).getEntry(new URL(id), WebPageEntry.class);
will(returnValue(oldEntry));
oneOf (entryUpdater).updateEntry(oldEntry, newEntry, sitesService);
will(returnValue(returnedEntry));
}});
assertEquals(returnedEntry, entryUploader.uploadEntry(newEntry,
new LinkedList<BasePageEntry<?>>(), feedUrl, sitesService));
}
示例2: testGetEntryElement
import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Test
public void testGetEntryElement() {
BaseContentEntry<?> entry = new AnnouncementEntry();
entry.setId("announce");
XmlElement element = RendererUtils.getEntryElement(entry, "div");
assertEquals("<div class=\"hentry announcement\" id=\"announce\" />",
element.toString());
}
示例3: uploadEntry
import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Override
public BaseContentEntry<?> uploadEntry(BaseContentEntry<?> entry,
List<BasePageEntry<?>> ancestors, URL feedUrl, SitesService sitesService) {
checkNotNull(entry);
checkNotNull(ancestors);
checkNotNull(feedUrl);
checkNotNull(sitesService);
BaseContentEntry<?> returnedEntry = null;
if (entry.getId() != null) {
if (entry.getId().startsWith(feedUrl.toExternalForm() + "/")) {
returnedEntry = getEntryById(entry, sitesService);
} else {
entry.setId(null);
}
}
if (returnedEntry == null) {
if (isPage(entry) ||
getType(entry) == ATTACHMENT ||
getType(entry) == WEB_ATTACHMENT) {
returnedEntry = getEntryByPath(entry, ancestors, feedUrl, sitesService);
} else if (getType(entry) == COMMENT) {
// TODO(gk5885): remove extra cast for
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
if (commentExists((CommentEntry) (BaseContentEntry) entry, feedUrl, sitesService)) {
return entry;
}
} else if (getType(entry) == LIST_ITEM) {
// TODO(gk5885): remove extra cast for
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6302214
if (listItemExists((ListItemEntry) (BaseContentEntry) entry, feedUrl, sitesService)) {
return entry;
}
}
}
if (returnedEntry == null) {
return entryInserter.insertEntry(entry, feedUrl, sitesService);
} else {
return entryUpdater.updateEntry(returnedEntry, entry,
sitesService);
}
}
示例4: testOnePageWithAttachment
import com.google.gdata.data.sites.BaseContentEntry; //导入方法依赖的package包/类
@Test
public void testOnePageWithAttachment() throws IOException {
final BasePageEntry<?> page = new FileCabinetPageEntry();
page.setId("1");
page.setTitle(new PlainTextConstruct("Page 1"));
page.setPageName(new PageName("Page-1"));
XmlBlob blob = new XmlBlob();
blob.setBlob("content");
page.setContent(new XhtmlTextConstruct(blob));
final BaseContentEntry<?> attachment = new AttachmentEntry();
attachment.setId("2");
attachment.setTitle(new PlainTextConstruct("attach this.wow"));
attachment.addLink(SitesLink.Rel.PARENT, ILink.Type.ATOM, "1");
entries.add(page);
entries.add(attachment);
final Appendable out = context.mock(Appendable.class);
context.checking(new Expectations() {{
allowing (entryStoreFactory).newEntryStore();
will(returnValue(entryStore));
allowing (feedProvider).getEntries(feedUrl, sitesService);
will(returnValue(entries));
allowing (entryStore).getEntry("1"); will(returnValue(page));
allowing (entryStore).getParent("1"); will(returnValue(null));
allowing (entryStore).getEntry("2"); will(returnValue(attachment));
allowing (entryStore).getParent("2"); will(returnValue(page));
allowing (progressListener).setStatus(with(any(String.class)));
allowing (progressListener).setProgress(with(any(Double.class)));
oneOf (entryStore).addEntry(page);
oneOf (entryStore).addEntry(attachment);
oneOf (appendableFactory).getAppendable(
new File("path/Page-1/index.html"));
will(returnValue(out));
oneOf (linkConverter).convertLinks(page, entryStore,
new URL("https://host/a/domain/webspace"), false);
oneOf (pageExporter).exportPage(page, entryStore, out, false);
}});
export(false);
assertTrue(downloaded.get(attachment).equals(
new File("path/Page-1/attach this.wow")));
}