use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_publish_update_publishedTime method set_published_time.
@Test
public void set_published_time() throws Exception {
final Content content = doCreateContent();
assertNull(content.getPublishInfo());
assertVersions(content.getId(), 1);
doPublishContent(content);
assertVersions(content.getId(), 2);
final Content storedContent = this.contentService.getById(content.getId());
assertNotNull(storedContent.getPublishInfo());
assertNotNull(storedContent.getPublishInfo().getFirst());
assertNotNull(storedContent.getPublishInfo().getFrom());
final Content publishedContent = ContextBuilder.from(ContextAccessor.current()).branch(WS_OTHER).build().callWith(() -> this.contentService.getById(content.getId()));
assertEquals(storedContent.getPublishInfo(), publishedContent.getPublishInfo());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class ContentServiceImplTest_publish_update_publishedTime method publish_info_is_removed_on_duplicate.
@Test
public void publish_info_is_removed_on_duplicate() throws Exception {
final Content rootContent = createContent(ContentPath.ROOT);
this.contentService.publish(PushContentParams.create().contentIds(ContentIds.from(rootContent.getId())).target(WS_OTHER).build());
final Content duplicateContent = doDuplicateContent(rootContent);
assertNull(duplicateContent.getPublishInfo());
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class TestDataFixtures method newContent.
public static Content newContent() {
final Content.Builder builder = Content.create();
builder.id(ContentId.from("123456"));
builder.name("mycontent");
builder.displayName("My Content");
builder.parentPath(ContentPath.from("/a/b"));
builder.modifier(PrincipalKey.from("user:system:admin"));
builder.modifiedTime(Instant.ofEpochSecond(0));
builder.creator(PrincipalKey.from("user:system:admin"));
builder.createdTime(Instant.ofEpochSecond(0));
builder.language(Locale.ENGLISH);
builder.data(newPropertyTree());
builder.addExtraData(new ExtraData(XDataName.from("com.enonic.myapplication:myschema"), newTinyPropertyTree()));
builder.page(newPage());
return builder.build();
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class GetCurrentContentScriptTest method testExample.
@Test
public void testExample() {
final Content content = TestDataFixtures.newExampleContent();
this.portalRequest.setContent(content);
runScript("/lib/xp/examples/portal/getContent.js");
}
use of com.enonic.xp.content.Content in project xp by enonic.
the class GetCurrentContentScriptTest method currentContentByContentPath.
@Test
public void currentContentByContentPath() {
final Content content = TestDataFixtures.newContent();
this.portalRequest.setContent(null);
this.portalRequest.setContentPath(content.getPath());
runFunction("/test/getCurrentContent-test.js", "noCurrentContent");
}
Aggregations