use of javax.jcr.Credentials in project sling by apache.
the class OakServerIT method testExplicitAdminLogin.
@Test
public void testExplicitAdminLogin() throws RepositoryException {
final Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
repository.login(creds).logout();
}
use of javax.jcr.Credentials in project sling by apache.
the class DavExIntegrationTest method testReadNode.
/** Create a node via Sling's http interface and verify that admin can
* read it via davex remote access.
*/
public void testReadNode() throws Exception {
final String path = "/DavExNodeTest_1_" + System.currentTimeMillis();
final String url = HTTP_BASE_URL + path;
// add some properties to the node
final Map<String, String> props = new HashMap<String, String>();
props.put("name1", "value1");
props.put("name2", "value2");
testClient.createNode(url, props);
// Oak does not support login without credentials, so to
// verify that davex access works we do need valid repository credentials.
final Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
Session session = repository.login(creds);
try {
final Node node = session.getNode(path);
assertNotNull(node);
assertEquals("value1", node.getProperty("name1").getString());
assertEquals("value2", node.getProperty("name2").getString());
} finally {
session.logout();
}
}
use of javax.jcr.Credentials in project sling by apache.
the class VltSerializationDataBuilder method init.
public void init(org.apache.sling.ide.transport.Repository repository, File contentSyncRoot) throws SerializationException {
this.repo = repository;
try {
this.skm = new SerializationKindManager();
this.skm.init(repository);
if (!contentSyncRoot.exists()) {
throw new IllegalArgumentException("contentSyncRoot does not exist: " + contentSyncRoot);
}
Repository jcrRepo = RepositoryUtils.getRepository(repo.getRepositoryInfo());
Credentials credentials = RepositoryUtils.getCredentials(repo.getRepositoryInfo());
session = jcrRepo.login(credentials);
RepositoryAddress address = RepositoryUtils.getRepositoryAddress(repo.getRepositoryInfo());
fs = fsLocator.getFileSystem(address, contentSyncRoot, session);
} catch (org.apache.sling.ide.transport.RepositoryException e) {
throw new SerializationException(e);
} catch (RepositoryException e) {
throw new SerializationException(e);
} catch (IOException e) {
throw new SerializationException(e);
} catch (ConfigurationException e) {
throw new SerializationException(e);
}
}
use of javax.jcr.Credentials in project sling by apache.
the class DefaultBatcherTest method prepare.
@Before
public void prepare() {
mockRepo = createMock(Repository.class);
credentials = createMock(Credentials.class);
batcher = new DefaultBatcher();
}
use of javax.jcr.Credentials in project sling by apache.
the class AbstractSlingLaunchpadOakTestSupport method testWrongLogin.
@Test(expected = RepositoryException.class)
public void testWrongLogin() throws RepositoryException {
final Credentials creds = new SimpleCredentials("badName", "badPAssword".toCharArray());
slingRepository.login(creds);
}
Aggregations