本文整理了Java中javax.jcr.Session.getProperty()
方法的一些代码示例,展示了Session.getProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Session.getProperty()
方法的具体详情如下:
包路径:javax.jcr.Session
类名称:Session
方法名:getProperty
[英]Returns the property at the specified absolute path in the workspace.
[中]返回工作区中指定绝对路径处的属性。
代码示例来源:origin: net.adamcin.oakpal/oakpal-core
@Override
public Property getProperty(String absPath) throws RepositoryException {
Property internal = delegate.getProperty(absPath);
return new PropertyFacade<>(internal, this);
}
代码示例来源:origin: apache/jackrabbit
/** {@inheritDoc} */
public RemoteProperty getProperty(String path)
throws RepositoryException, RemoteException {
try {
return (RemoteProperty) getRemoteItem(session.getProperty(path));
} catch (RepositoryException ex) {
throw getRepositoryException(ex);
}
}
代码示例来源:origin: io.wcm/io.wcm.testing.jcr-mock
@Override
public Property getProperty(final String relPath) throws RepositoryException {
String path = makeAbsolutePath(relPath);
return getSession().getProperty(path);
}
代码示例来源:origin: apache/jackrabbit
public Long call() throws Exception {
String path = propertyPaths.get(rnd.nextInt(propertyPaths.size()));
long t1 = System.currentTimeMillis();
Property property = session.getProperty(path);
long t2 = System.currentTimeMillis();
items.add(property);
return t2 - t1;
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testGetProperty() throws Exception {
sessionWrapper.getProperty("/included/excludeChannels");
try {
sessionWrapper.getProperty("/excluded/excludeChannels");
fail();
} catch (PathNotFoundException expected) {
}
}
代码示例来源:origin: info.magnolia/magnolia-core
/**
* Asserts that a property at the given path as the expected value.
*/
protected void assertConfig(String expectedValue, String path) throws RepositoryException {
assertEquals(expectedValue, MgnlContext.getJCRSession("config").getProperty(path).getString());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void getPropertyWithRelativePath() throws RepositoryException {
Session s = getAdminSession();
try {
s.getProperty("some-relative-path");
fail("Session.getProperty() with relative path must throw a RepositoryException");
} catch (RepositoryException e) {
// expected
}
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void setPropertyAgain() throws RepositoryException {
Session session = getAdminSession();
Property p1 = session.getProperty("/foo/stringProp");
Property p2 = p1.getParent().setProperty("stringProp", "newValue");
Property p3 = session.getProperty("/foo/stringProp");
assertEquals("newValue", p1.getString());
assertEquals("newValue", p2.getString());
assertEquals("newValue", p3.getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void doNotOverride() throws Exception {
// GIVEN
sessionConfig.getRootNode().addNode("someSrcNode").setProperty("someProperty", "somePropertyValue");
sessionConfig.getRootNode().addNode("someDestNode").setProperty("someProperty", "someOldValue");
Task task = new CopyPropertyTask("name", RepositoryConstants.CONFIG, "/someSrcNode", "/someDestNode", "someProperty", false);
// WHEN
task.execute(installContext);
// THEN
assertTrue(sessionConfig.propertyExists("/someSrcNode/someProperty"));
assertEquals("someOldValue", sessionConfig.getProperty("/someDestNode/someProperty").getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testDoNotOverride() throws Exception {
// GIVEN
sessionConfig.getRootNode().addNode("someSrcNode").setProperty("someProperty", "somePropertyValue");
sessionConfig.getRootNode().addNode("someDestNode").setProperty("someProperty", "someOldValue");
Task task = new MovePropertyTask("name", RepositoryConstants.CONFIG, "/someSrcNode/someProperty", "/someDestNode/someProperty", false);
// WHEN
task.execute(installContext);
// THEN
assertTrue(sessionConfig.propertyExists("/someSrcNode/someProperty"));
assertEquals("someOldValue", sessionConfig.getProperty("/someDestNode/someProperty").getString());
}
代码示例来源:origin: ModeShape/modeshape
@FixFor( "MODE-1005" )
public void testShouldThrowRepositoryExceptionForRelativePathsInSessionGetProperty() throws Exception {
try {
Node root = getTestRoot(superuser);
root.addNode("propertyNodeForRelativePathTest", "nt:unstructured");
superuser.getProperty("propertyNodeForRelativePathTest/jcr:primaryType");
fail("Should throw RepositoryException when attempting to call Session.getProperty(String) with a relative path");
} catch (RepositoryException re) {
// Expected
}
}
代码示例来源:origin: apache/jackrabbit-oak
public static void verifyBlob(Session session) throws IOException, RepositoryException {
Property p = session.getProperty("/sling-logo.png/jcr:content/jcr:data");
InputStream is = p.getValue().getBinary().getStream();
String expectedMD5 = "35504d8c59455ab12a31f3d06f139a05";
try {
assertEquals(expectedMD5, DigestUtils.md5Hex(is));
} finally {
is.close();
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-framework-compatibility
@Test
public void testDialogsAreAddedModalityLevelProperty() throws ModuleManagementException, RepositoryException {
// GIVEN
this.setupConfigNode("/modules/ui-framework/dialogs/rename");
this.setupConfigNode("/modules/ui-framework/dialogs/folder");
// WHEN
executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.2.2"));
// THEN
assertEquals("light", session.getProperty("/modules/ui-framework/dialogs/rename/modalityLevel").getString());
assertEquals("light", session.getProperty("/modules/ui-framework/dialogs/folder/modalityLevel").getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void testExecute() throws RepositoryException, TaskExecutionException {
// GIVEN
ModuleFilesExtraction task = new ModuleFilesExtraction();
// WHEN
task.execute(ctx);
// THEN
assertTrue(new File("docroot/moduleName/avatar.jpg").exists());
assertTrue(session.propertyExists("/server/install/mgnl-files/docroot/moduleName/avatar.jpg/md5"));
assertEquals("f4b00bf28d5e67083a9721f8fbae6278", session.getProperty("/server/install/mgnl-files/docroot/moduleName/avatar.jpg/md5").getString());
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void updateFrom523ChangesConfigurationAppClass() throws Exception {
// GIVEN
setupConfigProperty("modules/ui-admincentral/apps/configuration", "class", "info.magnolia.ui.api.app.registry.ConfiguredAppDescriptor");
// WHEN
executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.2.3"));
// THEN
assertEquals("info.magnolia.ui.contentapp.ContentAppDescriptor", session.getProperty("/modules/ui-admincentral/apps/configuration/class").getString());
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSessionGetProperty() throws Exception {
Property pp = superuser.getProperty(p.getPath());
assertTrue(p.isSame(pp));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void setDoubleNaNProperty() throws RepositoryException, IOException {
Node parentNode = getNode(TEST_PATH);
addProperty(parentNode, "NaN", getAdminSession().getValueFactory().createValue(Double.NaN));
Session session2 = createAnonymousSession();
try {
Property property2 = session2.getProperty(TEST_PATH + "/NaN");
assertTrue(Double.isNaN(property2.getDouble()));
} finally {
session2.logout();
}
}
代码示例来源:origin: info.magnolia.ui/magnolia-ui-admincentral
@Test
public void updateFrom521AddsEmptyItemTypesInToParamsOfActivateAction() throws Exception {
// GIVEN
this.setupConfigNode("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate");
// WHEN
executeUpdatesAsIfTheCurrentlyInstalledVersionWas(Version.parseVersion("5.2.1"));
// THEN
assertTrue(session.itemExists("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate/params/itemTypes"));
assertEquals("", session.getProperty("/modules/ui-admincentral/apps/configuration/subApps/browser/actions/activate/params/itemTypes").getString());
}
代码示例来源:origin: info.magnolia/magnolia-core
@Test
public void execute() throws Exception {
// GIVEN
setUpActivation();
Task task = new SetupModuleRepositoriesTask();
// WHEN
task.execute(installContext);
// THEN
assertTrue(sessionConfig.itemExists("/server/activation/subscribers/someSubscriber/subscriptions"));
assertTrue(sessionConfig.propertyExists("/server/activation/subscribers/someSubscriber/subscriptions/config/repository"));
assertEquals(RepositoryConstants.CONFIG, sessionConfig.getProperty("/server/activation/subscribers/someSubscriber/subscriptions/config/repository").getString());
assertThat(installContext.getMessages().values(), hasSize(0));
}
代码示例来源:origin: apache/jackrabbit-oak
@Test
public void testSingleValueToMultiValue() throws RepositoryException, NotExecutableException {
Value v = superuser.getValueFactory().createValue("testValue");
try {
user.setProperty("testProperty", v);
superuser.save();
} catch (RepositoryException e) {
throw new NotExecutableException("Cannot test 'Authorizable.setProperty'.");
}
user.setProperty("testProperty", new Value[] {v});
Property p = superuser.getProperty(user.getPath() + "/testProperty");
assertTrue(p.isMultiple());
}
内容来源于网络,如有侵权,请联系作者删除!