Author: elvisisking
Date: 2009-12-18 15:56:07 -0500 (Fri, 18 Dec 2009)
New Revision: 1460
Removed:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/validation/
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
Log:
DNA-592 The DNA REST Server Registry Should Be Moved From The DNA REST Client Maven
Project To The Eclipse Plugin: This commit is removing the registry from the maven
project. Also removed the Server property that indicates if the password should be
persisted from session to session. The registry and this server property have both been
moved to the Eclipse plugin.
Deleted:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/IServerRegistryListener.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -1,37 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-/**
- * The <code>IServerRegistryListener</code> interface defines the API for a
server registry listener.
- */
-public interface IServerRegistryListener {
-
- /**
- * @param event the event being processed (never <code>null</code>)
- * @return any errors caught during the processing or <code>null</code>
- */
- Exception[] serverRegistryChanged( ServerRegistryEvent event );
-
-}
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/RestClientI18n.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -30,54 +30,14 @@
*/
public final class RestClientI18n {
- public static I18n errorDeletingServerRegistryFile;
-
- public static I18n errorRestoringServerRegistry;
-
- public static I18n errorSavingServerRegistry;
-
public static I18n nullArgumentMsg;
- public static I18n repositoryEmptyNameMsg;
-
- public static I18n repositoryNullServerMsg;
-
public static I18n repositoryShortDescription;
- public static I18n serverEmptyUrlMsg;
-
- public static I18n serverEmptyUserMsg;
-
- public static I18n serverExistsMsg;
-
- public static I18n serverInvalidUrlMsg;
-
- public static I18n serverManagerConnectionEstablishedMsg;
-
- public static I18n serverManagerConnectionFailedMsg;
-
- public static I18n serverManagerRegistryAddUnexpectedError;
-
- public static I18n serverManagerRegistryListenerError;
-
- public static I18n serverManagerRegistryListenerErrorsOccurred;
-
- public static I18n serverManagerRegistryRemoveUnexpectedError;
-
- public static I18n serverManagerRegistryUpdateAddError;
-
- public static I18n serverManagerRegistryUpdateRemoveError;
-
- public static I18n serverManagerUnregisteredServer;
-
public static I18n serverShortDescription;
public static I18n unknownHttpRequestMethodMsg;
- public static I18n workspaceEmptyNameMsg;
-
- public static I18n workspaceNullRepositoryMsg;
-
public static I18n workspaceShortDescription;
// JsonRestClient messages
Deleted:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerManager.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -1,677 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-import net.jcip.annotations.GuardedBy;
-import net.jcip.annotations.ThreadSafe;
-import org.jboss.dna.common.util.Base64;
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.common.util.Logger;
-import org.jboss.dna.web.jcr.rest.client.Status.Severity;
-import org.jboss.dna.web.jcr.rest.client.domain.Repository;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
-import org.jboss.dna.web.jcr.rest.client.json.JsonRestClient;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * The <code>ServerManager</code> class managers the creation, deletion, and
editing of servers hosting DNA repositories.
- */
-@ThreadSafe
-public final class ServerManager implements IRestClient {
-
- //
===========================================================================================================================
- // Constants
- //
===========================================================================================================================
-
- /**
- * The tag used to persist a server's login password.
- */
- private static final String PASSWORD_TAG = "password"; //$NON-NLS-1$
-
- /**
- * The file name used when persisting the server registry.
- */
- private static final String REGISTRY_FILE = "serverRegistry.xml";
//$NON-NLS-1$
-
- /**
- * The tag used when persisting a server.
- */
- private static final String SERVER_TAG = "server"; //$NON-NLS-1$
-
- /**
- * The server collection tag used when persisting the server registry.
- */
- private static final String SERVERS_TAG = "servers"; //$NON-NLS-1$
-
- /**
- * The tag used to persist a server's URL.
- */
- private static final String URL_TAG = "url"; //$NON-NLS-1$
-
- /**
- * The tag used to persist a server's login user.
- */
- private static final String USER_TAG = "user"; //$NON-NLS-1$
-
- //
===========================================================================================================================
- // Fields
- //
===========================================================================================================================
-
- /**
- * The listeners registered to receive {@link ServerRegistryEvent server registry
events}.
- */
- private final CopyOnWriteArrayList<IServerRegistryListener> listeners;
-
- /**
- * Executes the commands run on the DNA REST server.
- */
- private final IRestClient delegate;
-
- /**
- * The logger.
- */
- private final Logger logger = Logger.getLogger(ServerManager.class);
-
- /**
- * The path where the server registry is persisted or <code>null</code>
if not persisted.
- */
- private final String stateLocationPath;
-
- /**
- * The server registry.
- */
- @GuardedBy( "serverLock" )
- private final List<Server> servers;
-
- /**
- * Lock used for when accessing the server registry.
- */
- private final ReadWriteLock serverLock = new ReentrantReadWriteLock();
-
- //
===========================================================================================================================
- // Constructors
- //
===========================================================================================================================
-
- /**
- * @param stateLocationPath the directory where the {@link Server} registry} is
persisted (may be <code>null</code> if
- * persistence is not desired)
- * @param restClient the client that will communicate with the DNA REST server (never
<code>null</code>)
- */
- public ServerManager( String stateLocationPath,
- IRestClient restClient ) {
- CheckArg.isNotNull(restClient, "restClient"); //$NON-NLS-1$
-
- this.servers = new ArrayList<Server>();
- this.stateLocationPath = stateLocationPath;
- this.delegate = restClient;
- this.listeners = new CopyOnWriteArrayList<IServerRegistryListener>();
- }
-
- /**
- * This server manager uses the default REST Client.
- *
- * @param stateLocationPath the directory where the {@link Server} registry} is
persisted (may be <code>null</code> if
- * persistence is not desired)
- */
- public ServerManager( String stateLocationPath ) {
- this(stateLocationPath, new JsonRestClient());
- }
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- /**
- * Listeners already registered will not be added again. The new listener will
receive events for all existing servers.
- *
- * @param listener the listener being register to receive events (never
<code>null</code>)
- * @return <code>true</code> if listener was added
- */
- public boolean addRegistryListener( IServerRegistryListener listener ) {
- CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
- boolean result = this.listeners.addIfAbsent(listener);
-
- // inform new listener of registered servers
- for (Server server : getServers()) {
- listener.serverRegistryChanged(ServerRegistryEvent.createNewEvent(this,
server));
- }
-
- return result;
- }
-
- /**
- * Registers the specified <code>Server</code>.
- *
- * @param server the server being added (never <code>null</code>)
- * @return a status indicating if the server was added to the registry
- */
- public Status addServer( Server server ) {
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
- return internalAddServer(server, true);
- }
-
- /**
- * @param url the URL of the server being requested (never
<code>null</code>)
- * @param user the user ID of the server being requested (never
<code>null</code>)
- * @return the requested server or <code>null</code> if not found in the
registry
- */
- public Server findServer( String url,
- String user ) {
- CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
- CheckArg.isNotNull(user, "user"); //$NON-NLS-1$
-
- for (Server server : getServers()) {
- if (url.equals(server.getUrl()) && user.equals(server.getUser())) {
- return server;
- }
- }
-
- return null;
- }
-
- /**
- * @return an unmodifiable collection of registered servers (never
<code>null</code>)
- */
- public Collection<Server> getServers() {
- try {
- this.serverLock.readLock().lock();
- return Collections.unmodifiableCollection(new
ArrayList<Server>(this.servers));
- } finally {
- this.serverLock.readLock().unlock();
- }
- }
-
- /**
- * @return the name of the state file that the server registry is persisted to or
<code>null</code>
- */
- private String getStateFileName() {
- String name = this.stateLocationPath;
-
- if (this.stateLocationPath != null) {
- name += File.separatorChar + REGISTRY_FILE;
- }
-
- return name;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#getRepositories(org.jboss.dna.web.jcr.rest.client.domain.Server)
- * @throws RuntimeException if the server is not registered
- * @see #isRegistered(Server)
- */
- public Collection<Repository> getRepositories( Server server ) throws Exception
{
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
-
- try {
- this.serverLock.readLock().lock();
-
- if (isRegistered(server)) {
- Collection<Repository> repositories =
this.delegate.getRepositories(server);
- return Collections.unmodifiableCollection(new
ArrayList<Repository>(repositories));
- }
-
- // server must be registered in order to obtain it's repositories
- throw new
RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
- } finally {
- this.serverLock.readLock().unlock();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.web.jcr.rest.client.IRestClient#getUrl(java.io.File,
java.lang.String,
- * org.jboss.dna.web.jcr.rest.client.domain.Workspace)
- */
- public URL getUrl( File file,
- String path,
- Workspace workspace ) throws Exception {
- return this.delegate.getUrl(file, path, workspace);
- }
-
- /**
- * {@inheritDoc}
- *
- * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#getWorkspaces(org.jboss.dna.web.jcr.rest.client.domain.Repository)
- * @throws RuntimeException if the server is not registered
- * @see #isRegistered(Server)
- */
- public Collection<Workspace> getWorkspaces( Repository repository ) throws
Exception {
- CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
-
- try {
- this.serverLock.readLock().lock();
-
- if (isRegistered(repository.getServer())) {
- Collection<Workspace> workspaces =
this.delegate.getWorkspaces(repository);
- return Collections.unmodifiableCollection(new
ArrayList<Workspace>(workspaces));
- }
-
- // a repository's server must be registered in order to obtain it's
workspaces
- String msg =
RestClientI18n.serverManagerUnregisteredServer.text(repository.getServer().getShortDescription());
- throw new RuntimeException(msg);
- } finally {
- this.serverLock.readLock().unlock();
- }
- }
-
- /**
- * Registers the specified <code>Server</code>.
- *
- * @param server the server being added
- * @param notifyListeners indicates if registry listeners should be notified
- * @return a status indicating if the server was added to the registry
- */
- private Status internalAddServer( Server server,
- boolean notifyListeners ) {
- boolean added = false;
-
- try {
- this.serverLock.writeLock().lock();
-
- if (!isRegistered(server)) {
- added = this.servers.add(server);
- }
- } finally {
- this.serverLock.writeLock().unlock();
- }
-
- if (added) {
- if (notifyListeners) {
- Exception[] errors =
notifyRegistryListeners(ServerRegistryEvent.createNewEvent(this, server));
- return processRegistryListenerErrors(errors);
- }
-
- return Status.OK_STATUS;
- }
-
- // server already exists
- return new Status(Severity.ERROR,
RestClientI18n.serverExistsMsg.text(server.getShortDescription()), null);
- }
-
- /**
- * @param server the server being removed
- * @param notifyListeners indicates if registry listeners should be notified
- * @return a status indicating if the specified server was removed from the registry
- */
- private Status internalRemoveServer( Server server,
- boolean notifyListeners ) {
- boolean removed = false;
-
- try {
- this.serverLock.writeLock().lock();
-
- // see if registered server has the same key
- for (Server registeredServer : this.servers) {
- if (registeredServer.hasSameKey(server)) {
- removed = this.servers.remove(registeredServer);
- break;
- }
- }
- } finally {
- this.serverLock.writeLock().unlock();
- }
-
- if (removed) {
- if (notifyListeners) {
- Exception[] errors =
notifyRegistryListeners(ServerRegistryEvent.createRemoveEvent(this, server));
- return processRegistryListenerErrors(errors);
- }
-
- return Status.OK_STATUS;
- }
-
- // server could not be removed
- return new Status(Severity.ERROR,
-
RestClientI18n.serverManagerRegistryRemoveUnexpectedError.text(server.getShortDescription()),
null);
- }
-
- /**
- * @param server the server being tested (never <code>null</code>)
- * @return <code>true</code> if the server has been registered
- * @see #addServer(Server)
- */
- public boolean isRegistered( Server server ) {
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
-
- try {
- this.serverLock.readLock().lock();
-
- // check to make sure no other registered server has the same key
- for (Server registeredServer : this.servers) {
- if (registeredServer.hasSameKey(server)) {
- return true;
- }
- }
-
- return false;
- } finally {
- this.serverLock.readLock().unlock();
- }
- }
-
- /**
- * @param event the event the registry listeners are to process
- * @return any errors thrown by or found by the listeners or
<code>null</code> (never empty)
- */
- private Exception[] notifyRegistryListeners( ServerRegistryEvent event ) {
- Collection<Exception> errors = null;
-
- for (IServerRegistryListener l : this.listeners) {
- try {
- Exception[] problems = l.serverRegistryChanged(event);
-
- if ((problems != null) && (problems.length != 0)) {
- if (errors == null) {
- errors = new ArrayList<Exception>();
- }
-
- errors.addAll(Arrays.asList(problems));
- }
- } catch (Exception e) {
- if (errors == null) {
- errors = new ArrayList<Exception>();
- }
-
- errors.add(e);
- }
- }
-
- if ((errors != null) && !errors.isEmpty()) {
- return errors.toArray(new Exception[errors.size()]);
- }
-
- return null;
- }
-
- /**
- * @param errors the errors reported by the registry listeners
- * @return a status indicating if registry listeners reported any errors
- */
- private Status processRegistryListenerErrors( Exception[] errors ) {
- if (errors == null) {
- return Status.OK_STATUS;
- }
-
- for (Exception error : errors) {
- this.logger.error(error, RestClientI18n.serverManagerRegistryListenerError);
- }
-
- return new Status(Severity.WARNING,
RestClientI18n.serverManagerRegistryListenerErrorsOccurred.text(), null);
- }
-
- /**
- * Attempts to connect to the server. The server does
<strong>NOT</strong> need to be registered.
- *
- * @param server the server being pinged (never <code>null</code>)
- * @return a status indicating if the server can be connected to
- * @see #isRegistered(Server)
- */
- public Status ping( Server server ) {
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
-
- try {
- this.delegate.getRepositories(server);
- return new Status(Severity.OK,
RestClientI18n.serverManagerConnectionEstablishedMsg.text(), null);
- } catch (Exception e) {
- return new Status(Severity.ERROR,
RestClientI18n.serverManagerConnectionFailedMsg.text(e), null);
- }
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Only tries to unpublish if the workspace's {@link Server server} is
registered.
- *
- * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#publish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
- * java.lang.String, java.io.File)
- * @see #isRegistered(Server)
- */
- public Status publish( Workspace workspace,
- String path,
- File file ) {
- CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
- CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
- CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
-
- Server server = workspace.getServer();
-
- if (isRegistered(server)) {
- return this.delegate.publish(workspace, path, file);
- }
-
- // server must be registered in order to publish
- throw new
RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
- }
-
- /**
- * @param listener the listener being unregistered and will no longer receive events
(never <code>null</code>)
- * @return <code>true</code> if listener was removed
- */
- public boolean removeRegistryListener( IServerRegistryListener listener ) {
- CheckArg.isNotNull(listener, "listener"); //$NON-NLS-1$
- return this.listeners.remove(listener);
- }
-
- /**
- * @param server the server being removed (never <code>null</code>)
- * @return a status indicating if the specified server was removed from the registry
(never <code>null</code>)
- */
- public Status removeServer( Server server ) {
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
- return internalRemoveServer(server, true);
- }
-
- /**
- * @return a status indicating if the previous session state was restored
successfully
- */
- public Status restoreState() {
- if (this.stateLocationPath != null) {
- if (stateFileExists()) {
- try {
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = factory.newDocumentBuilder();
- Document doc = docBuilder.parse(new File(getStateFileName()));
- Node root = doc.getDocumentElement();
- NodeList servers = root.getChildNodes();
-
- for (int size = servers.getLength(), i = 0; i < size; ++i) {
- Node server = servers.item(i);
-
- if (server.getNodeType() != Node.TEXT_NODE) {
- NamedNodeMap attributeMap = server.getAttributes();
-
- if (attributeMap == null) continue;
-
- Node urlNode = attributeMap.getNamedItem(URL_TAG);
- Node userNode = attributeMap.getNamedItem(USER_TAG);
- Node passwordNode = attributeMap.getNamedItem(PASSWORD_TAG);
- String pswd = ((passwordNode == null) ? null : new
String(Base64.decode(passwordNode.getNodeValue()),
-
"UTF-8")); //$NON-NLS-1$
-
- // add server to registry
- addServer(new Server(urlNode.getNodeValue(),
userNode.getNodeValue(), pswd, (pswd != null)));
- }
- }
- } catch (Exception e) {
- return new Status(Severity.ERROR,
RestClientI18n.errorRestoringServerRegistry.text(getStateFileName()), e);
- }
- }
- }
-
- // do nothing of there is no save location or state file does not exist
- return Status.OK_STATUS;
- }
-
- /**
- * Saves the {@link Server} registry to the file system.
- *
- * @return a status indicating if the registry was successfully saved
- */
- public Status saveState() {
- if ((this.stateLocationPath != null) && !getServers().isEmpty()) {
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = factory.newDocumentBuilder();
- Document doc = docBuilder.newDocument();
-
- // create root element
- Element root = doc.createElement(SERVERS_TAG);
- doc.appendChild(root);
-
- for (Server server : getServers()) {
- Element serverElement = doc.createElement(SERVER_TAG);
- root.appendChild(serverElement);
-
- serverElement.setAttribute(URL_TAG, server.getUrl());
- serverElement.setAttribute(USER_TAG, server.getUser());
-
- if (server.isPasswordBeingPersisted()) {
- serverElement.setAttribute(PASSWORD_TAG,
Base64.encodeBytes(server.getPassword().getBytes()));
- }
- }
-
- DOMSource source = new DOMSource(doc);
- StreamResult resultXML = new StreamResult(new
FileOutputStream(getStateFileName()));
- TransformerFactory transFactory = TransformerFactory.newInstance();
- Transformer transformer = transFactory.newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
//$NON-NLS-1$
-
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-am...;,
"2"); //$NON-NLS-1$ //$NON-NLS-2$
- transformer.transform(source, resultXML);
- } catch (Exception e) {
- return new Status(Severity.ERROR,
RestClientI18n.errorSavingServerRegistry.text(getStateFileName()), e);
- }
- } else if ((this.stateLocationPath != null) && stateFileExists()) {
- // delete current registry file since all servers have been deleted
- try {
- new File(getStateFileName()).delete();
- } catch (Exception e) {
- return new Status(Severity.ERROR,
RestClientI18n.errorDeletingServerRegistryFile.text(getStateFileName()), e);
- }
- }
-
- return Status.OK_STATUS;
- }
-
- /**
- * @return <code>true</code> if the state file already exists
- */
- private boolean stateFileExists() {
- return new File(getStateFileName()).exists();
- }
-
- /**
- * {@inheritDoc}
- * <p>
- * Only tries to unpublish if the workspace's {@link Server server} is
registered.
- *
- * @see
org.jboss.dna.web.jcr.rest.client.IRestClient#unpublish(org.jboss.dna.web.jcr.rest.client.domain.Workspace,
- * java.lang.String, java.io.File)
- * @see #isRegistered(Server)
- */
- public Status unpublish( Workspace workspace,
- String path,
- File file ) {
- CheckArg.isNotNull(workspace, "workspace"); //$NON-NLS-1$
- CheckArg.isNotNull(path, "path"); //$NON-NLS-1$
- CheckArg.isNotNull(file, "file"); //$NON-NLS-1$
-
- Server server = workspace.getServer();
-
- if (isRegistered(server)) {
- return this.delegate.unpublish(workspace, path, file);
- }
-
- // server must be registered in order to unpublish
- throw new
RuntimeException(RestClientI18n.serverManagerUnregisteredServer.text(server.getShortDescription()));
- }
-
- /**
- * Updates the server registry with a new version of a server.
- *
- * @param previousServerVersion the version of the server being replaced (never
<code>null</code>)
- * @param newServerVersion the new version of the server being put in the server
registry (never <code>null</code>)
- * @return a status indicating if the server was updated in the registry (never
<code>null</code>)
- */
- public Status updateServer( Server previousServerVersion,
- Server newServerVersion ) {
- CheckArg.isNotNull(previousServerVersion, "previousServerVersion");
//$NON-NLS-1$
- CheckArg.isNotNull(newServerVersion, "newServerVersion");
//$NON-NLS-1$
-
- Status status = null;
-
- try {
- this.serverLock.writeLock().lock();
- status = internalRemoveServer(previousServerVersion, false);
-
- if (status.isOk()) {
- status = internalAddServer(newServerVersion, false);
-
- if (status.isOk()) {
- // all good so notify listeners
- Exception[] errors =
notifyRegistryListeners(ServerRegistryEvent.createUpdateEvent(this,
-
previousServerVersion,
-
newServerVersion));
- return processRegistryListenerErrors(errors);
- }
-
- // unexpected problem adding new version of server to registry
- return new Status(Severity.ERROR,
RestClientI18n.serverManagerRegistryUpdateAddError.text(status.getMessage()),
- status.getException());
- }
- } finally {
- this.serverLock.writeLock().unlock();
- }
-
- // unexpected problem removing server from registry
- return new Status(Severity.ERROR,
RestClientI18n.serverManagerRegistryUpdateRemoveError.text(status.getMessage()),
- status.getException());
- }
-
-}
Deleted:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/ServerRegistryEvent.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -1,204 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import org.jboss.dna.common.util.CheckArg;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-
-/**
- * The <code>ServerRegistryEvent</code> class is the event that is broadcast
from the {@link ServerManager server manager} when a
- * server is added, removed, or changed.
- */
-public final class ServerRegistryEvent {
-
- //
===========================================================================================================================
- // Constants
- //
===========================================================================================================================
-
- /**
- * The status severity levels.
- */
- private enum Type {
- /**
- * Indicates that a new server was added to the server registry.
- */
- NEW,
-
- /**
- * Indicates that a server was removed from the server registry.
- */
- REMOVE,
-
- /**
- * Indicates that properties of an existing server in the registry has been
changed.
- */
- UPDATE
- }
-
- //
===========================================================================================================================
- // Class Methods
- //
===========================================================================================================================
-
- /**
- * @param serverManager the server manager sourcing this event (never
<code>null</code>)
- * @param newServer the server that was added to the server registry (never
<code>null</code>)
- * @return the event (never <code>null</code>)
- * @see Type#NEW
- */
- public static ServerRegistryEvent createNewEvent( ServerManager serverManager,
- Server newServer ) {
- CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
- CheckArg.isNotNull(newServer, "newServer"); //$NON-NLS-1$
- return new ServerRegistryEvent(serverManager, Type.NEW, newServer);
- }
-
- /**
- * @param serverManager the server manager sourcing this event (never
<code>null</code>)
- * @param removedServer the server removed from the server registry (never
<code>null</code>)
- * @return the event (never <code>null</code>)
- * @see Type#REMOVE
- */
- public static ServerRegistryEvent createRemoveEvent( ServerManager serverManager,
- Server removedServer ) {
- CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
- CheckArg.isNotNull(removedServer, "removedServer"); //$NON-NLS-1$
- return new ServerRegistryEvent(serverManager, Type.REMOVE, removedServer);
- }
-
- /**
- * @param serverManager the server manager sourcing this event (never
<code>null</code>)
- * @param previousServerVersion the server being updated (never
<code>null</code>)
- * @param newServerVersion the updated version of the server (never
<code>null</code>)
- * @return the event (never <code>null</code>)
- * @see Type#UPDATE
- */
- public static ServerRegistryEvent createUpdateEvent( ServerManager serverManager,
- Server previousServerVersion,
- Server newServerVersion ) {
- CheckArg.isNotNull(serverManager, "serverManager"); //$NON-NLS-1$
- CheckArg.isNotNull(previousServerVersion, "previousServerVersion");
//$NON-NLS-1$
- CheckArg.isNotNull(newServerVersion, "newServerVersion");
//$NON-NLS-1$
-
- ServerRegistryEvent event = new ServerRegistryEvent(serverManager, Type.UPDATE,
previousServerVersion);
- event.updatedServer = newServerVersion;
- return event;
- }
-
- //
===========================================================================================================================
- // Fields
- //
===========================================================================================================================
-
- /**
- * The server being added, removed, or updated.
- */
- private final Server server;
-
- /**
- * The server manager in charge of the server registry the event is associated with.
- */
- private final ServerManager serverManager;
-
- /**
- * The event type.
- */
- private final Type type;
-
- /**
- * The server that is replacing an existing server. Will be
<code>null</code> for all types except {@link Type#UPDATE update}.
- */
- private Server updatedServer;
-
- //
===========================================================================================================================
- // Constructors
- //
===========================================================================================================================
-
- /**
- * @param serverManager the server manager sourcing this event
- * @param type the event type
- * @param server the server being added, removed, or updated
- */
- private ServerRegistryEvent( ServerManager serverManager,
- Type type,
- Server server ) {
- this.serverManager = serverManager;
- this.type = type;
- this.server = server;
- }
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- /**
- * @return the added, removed, or the old version of the server that has been
updated
- */
- public Server getServer() {
- return this.server;
- }
-
- /**
- * @return the server manager sourcing this event
- */
- public ServerManager getServerManager() {
- return this.serverManager;
- }
-
- /**
- * @return the new version of an existing server that has been updated
- * @throws UnsupportedOperationException if method is called when the type is not an
update
- * @see Type#UPDATE
- */
- public Server getUpdatedServer() {
- if (this.type != Type.UPDATE) {
- throw new UnsupportedOperationException();
- }
-
- return this.updatedServer;
- }
-
- /**
- * @return <code>true</code> if the event is adding a new server to the
registry
- * @see Type#NEW
- */
- public boolean isNew() {
- return (this.type == Type.NEW);
- }
-
- /**
- * @return <code>true</code> if the event is removing a server from the
registry
- * @see Type#REMOVE
- */
- public boolean isRemove() {
- return (this.type == Type.REMOVE);
- }
-
- /**
- * @return <code>true</code> if the event is updating properties of an
existing server in the registry
- * @see Type#UPDATE
- */
- public boolean isUpdate() {
- return (this.type == Type.UPDATE);
- }
-
-}
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Repository.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -27,14 +27,12 @@
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
/**
* The Repository class is the business object for a DNA repository.
*/
@Immutable
-public final class Repository implements IDnaObject {
+public class Repository implements IDnaObject {
//
===========================================================================================================================
// Fields
@@ -50,8 +48,6 @@
*/
private final Server server;
- // TODO root publishing path
-
//
===========================================================================================================================
// Constructors
//
===========================================================================================================================
@@ -61,22 +57,12 @@
*
* @param name the repository name (never <code>null</code>)
* @param server the server where this repository resides (never
<code>null</code>)
- * @see RepositoryValidator
- * @throws RuntimeException if any of the input parameters are invalid
+ * @throws IllegalArgumentException if the name or server argument is
<code>null</code>
*/
public Repository( String name,
Server server ) {
- CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
- CheckArg.isNotNull(server, "server"); //$NON-NLS-1$
-
- // validate inputs
- Status status = RepositoryValidator.isValid(name, server);
-
- if (status.isError()) {
- throw new RuntimeException(status.getMessage(), status.getException());
- }
-
- // valid so construct
+ CheckArg.isNotNull(name, "name");
+ CheckArg.isNotNull(server, "server");
this.name = name;
this.server = server;
}
@@ -95,7 +81,6 @@
if (this == obj) return true;
if ((obj == null) || (getClass() != obj.getClass())) return false;
- // must have another server
Repository otherRepository = (Repository)obj;
return (this.name.equals(otherRepository.name) &&
this.server.equals(otherRepository.server));
}
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Server.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -27,16 +27,13 @@
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.Status;
import org.jboss.dna.web.jcr.rest.client.Utils;
-import org.jboss.dna.web.jcr.rest.client.domain.validation.RepositoryValidator;
-import org.jboss.dna.web.jcr.rest.client.domain.validation.ServerValidator;
/**
* The <code>Server</code> class is the business object for a server that is
hosting one or more DNA repositories.
*/
@Immutable
-public final class Server implements IDnaObject {
+public class Server implements IDnaObject {
//
===========================================================================================================================
// Fields
@@ -48,17 +45,12 @@
private final String password;
/**
- * Indicates if the password should be stored locally when the server is persisted.
+ * The server URL (never <code>null</code>).
*/
- private final boolean persistPassword;
-
- /**
- * The server URL.
- */
private final String url;
/**
- * The user name to use when logging on to the server.
+ * The user name to use when logging on to the server (never
<code>null</code>).
*/
private final String user;
@@ -72,28 +64,17 @@
* @param url the server URL (never <code>null</code>)
* @param user the server user (may be <code>null</code>)
* @param password the server password (may be <code>null</code>)
- * @param persistPassword <code>true</code> if the password should be
stored
- * @see RepositoryValidator
- * @throws RuntimeException if any of the input parameters are invalid
+ * @throws IllegalArgumentException if the URL or user arguments are
<code>null</code>
*/
public Server( String url,
String user,
- String password,
- boolean persistPassword ) {
- CheckArg.isNotNull(url, "url"); //$NON-NLS-1$
+ String password ) {
+ CheckArg.isNotNull(url, "url");
+ CheckArg.isNotNull(user, "user");
- // valid inputs
- Status status = ServerValidator.isValid(url, user, password, persistPassword);
-
- if (status.isError()) {
- throw new RuntimeException(status.getMessage(), status.getException());
- }
-
- // valid so construct
this.url = url;
this.user = user;
this.password = password;
- this.persistPassword = persistPassword;
}
//
===========================================================================================================================
@@ -110,11 +91,9 @@
if (this == obj) return true;
if ((obj == null) || (getClass() != obj.getClass())) return false;
- // must have another server
Server otherServer = (Server)obj;
return Utils.equivalent(this.url, otherServer.url) &&
Utils.equivalent(this.user, otherServer.user)
- && Utils.equivalent(this.password, otherServer.password)
- && Utils.equivalent(this.persistPassword,
otherServer.persistPassword);
+ && Utils.equivalent(this.password, otherServer.password);
}
/**
@@ -143,14 +122,14 @@
}
/**
- * @return the server URL
+ * @return the server URL (never <code>null</code>)
*/
public String getUrl() {
return this.url;
}
/**
- * @return the server authentication user
+ * @return the server authentication user (never <code>null</code>)
*/
public String getUser() {
return this.user;
@@ -163,26 +142,22 @@
*/
@Override
public int hashCode() {
- return HashCode.compute(this.url, this.user, this.password,
this.persistPassword);
+ return HashCode.compute(this.url, this.user, this.password);
}
/**
+ * A server has the same identifying properties if their URL and user matches.
+ *
* @param otherServer the server whose key is being compared (never
<code>null</code>)
* @return <code>true</code> if the servers have the same key
+ * @throws IllegalArgumentException if the argument is <code>null</code>
*/
public boolean hasSameKey( Server otherServer ) {
- CheckArg.isNotNull(otherServer, "otherServer"); //$NON-NLS-1$
+ CheckArg.isNotNull(otherServer, "otherServer");
return (Utils.equivalent(this.url, otherServer.url) &&
Utils.equivalent(this.user, otherServer.user));
}
/**
- * @return persistPassword <code>true</code> if the password is being
persisted
- */
- public boolean isPasswordBeingPersisted() {
- return this.persistPassword;
- }
-
- /**
* {@inheritDoc}
*
* @see java.lang.Object#toString()
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/domain/Workspace.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -27,14 +27,12 @@
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.common.util.HashCode;
import org.jboss.dna.web.jcr.rest.client.RestClientI18n;
-import org.jboss.dna.web.jcr.rest.client.Status;
-import org.jboss.dna.web.jcr.rest.client.domain.validation.WorkspaceValidator;
/**
* The <code>Workspace</code> class is the business object for a DNA
repository workspace.
*/
@Immutable
-public final class Workspace implements IDnaObject {
+public class Workspace implements IDnaObject {
//
===========================================================================================================================
// Fields
@@ -59,22 +57,12 @@
*
* @param name the workspace name (never <code>null</code>)
* @param repository the repository where this workspace resides (never
<code>null</code>)
- * @see WorkspaceValidator
- * @throws RuntimeException if any of the input parameters are invalid
+ * @throws IllegalArgumentException if any of the arguments are
<code>null</code>
*/
public Workspace( String name,
Repository repository ) {
- CheckArg.isNotNull(name, "name"); //$NON-NLS-1$
- CheckArg.isNotNull(repository, "repository"); //$NON-NLS-1$
-
- // validate inputs
- Status status = WorkspaceValidator.isValid(name, repository);
-
- if (status.isError()) {
- throw new RuntimeException(status.getMessage(), status.getException());
- }
-
- // valid so construct
+ CheckArg.isNotNull(name, "name");
+ CheckArg.isNotNull(repository, "repository");
this.name = name;
this.repository = repository;
}
@@ -93,7 +81,6 @@
if (this == obj) return true;
if ((obj == null) || (getClass() != obj.getClass())) return false;
- // must have another server
Workspace otherWorkspace = (Workspace)obj;
return (this.name.equals(otherWorkspace.name) &&
this.repository.equals(otherWorkspace.repository));
}
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/java/org/jboss/dna/web/jcr/rest/client/package-info.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -22,12 +22,9 @@
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
/**
- * The JBoss DNA REST Client is a lightweight, non-UI Maven project that interacts with
the DNA REST server. A server
- * registry managed by the {@link ServerManager server manager} is used to publish and
unpublish files to/from DNA
- * {@link org.jboss.dna.web.jcr.rest.client.domain.Repository repository}
- * {@link org.jboss.dna.web.jcr.rest.client.domain.Workspace workspaces}. When a DNA
- * {@link org.jboss.dna.web.jcr.rest.client.domain.Server server} is added, deleted, or
updated in the registry the server manager
- * notifies all registered listeners.
+ * The JBoss DNA REST Client is a lightweight, non-UI Maven project that interacts with
the DNA REST server. An {@link IRestClient}
+ * is used to publish and unpublish files to/from DNA {@link
org.jboss.dna.web.jcr.rest.client.domain.Repository repository}
+ * {@link org.jboss.dna.web.jcr.rest.client.domain.Workspace workspaces}.
*/
package org.jboss.dna.web.jcr.rest.client;
\ No newline at end of file
Modified:
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/main/resources/org/jboss/dna/web/jcr/rest/client/RestClientI18n.properties 2009-12-18
20:56:07 UTC (rev 1460)
@@ -21,36 +21,14 @@
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
#
-errorDeletingServerRegistryFile = There was a problem deleting server registry file
"{0}"
-errorRestoringServerRegistry = Error trying to restore the server registry from file
"{0}"
-errorSavingServerRegistry = Error trying to save the server registry to "{0}"
-
nullArgumentMsg = The argument "{0}" may not be null.
-repositoryEmptyNameMsg = A repository name cannot be empty
-repositoryNullServerMsg = A repository server cannot be null
repositoryShortDescription = DNA Repository - Name: {0}, Server: {1}
-serverEmptyUserMsg = The user cannot be empty
-serverEmptyUrlMsg = A server URL cannot be empty
-serverExistsMsg = {0} already exists so it cannot be added
-serverInvalidUrlMsg = The value "{0}" is not a valid server URL
serverShortDescription = DNA Server - URL: {0} User: {1}
-serverManagerConnectionEstablishedMsg = Connection established.
-serverManagerConnectionFailedMsg = Connection failed. Error Message: {0}
-serverManagerRegistryAddUnexpectedError = Unexpected error adding server to registry
-serverManagerRegistryListenerError = This error was reported by an
IServerRegistryListener
-serverManagerRegistryListenerErrorsOccurred = Errors occurred processing a server
registry event. Check error log for more details.
-serverManagerRegistryRemoveUnexpectedError = {0} cannot be removed as it has not been
registered
-serverManagerRegistryUpdateAddError = There was an unexpected error updating the server
in the registry. The old version of the server was successfully removed. However, the new
version was not updated. Detail: {0}
-serverManagerRegistryUpdateRemoveError = There was an unexpected error updating the
server in the registry. The server has not been updated in the server registry. Detail:
{0}
-serverManagerUnregisteredServer = Server "{0}" is not registered so it's
repositories and workspaces cannot be obtained and it cannot be involved in a publishing
operation.
-
unknownHttpRequestMethodMsg = The "{0}" HTTP request method is not valid.
-workspaceEmptyNameMsg = A workspace name cannot be empty
-workspaceNullRepositoryMsg = A workspace repository cannot be null
workspaceShortDescription = DNA Workspace - Name: {0}, Repository: {1}
# JsonRestClient messages
Deleted:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/RestIntegrationTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -1,119 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import static org.hamcrest.core.Is.is;
-import static org.hamcrest.core.IsNull.notNullValue;
-import static org.junit.Assert.assertThat;
-import java.io.File;
-import java.net.URL;
-import java.util.Collection;
-import org.jboss.dna.web.jcr.rest.client.domain.Repository;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-import org.jboss.dna.web.jcr.rest.client.domain.Workspace;
-import org.jboss.dna.web.jcr.rest.client.json.JsonRestClient;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- */
-public final class RestIntegrationTest {
-
- //
===========================================================================================================================
- // Constants
- //
===========================================================================================================================
-
- // user and password configured in pom
- private static final String PSWD = "password"; //$NON-NLS-1$
- private static final String USER = "dnauser"; //$NON-NLS-1$
-
- private static final Server SERVER = new Server("http://localhost:8080",
USER, PSWD, false); //$NON-NLS-1$
- private static final String REPOSITORY_NAME = "dna:repository";
//$NON-NLS-1$
- private static final Repository REPOSITORY = new Repository(REPOSITORY_NAME,
SERVER);
- private static final String WORKSPACE_NAME = "default"; //$NON-NLS-1$
- private static final Workspace WORKSPACE = new Workspace(WORKSPACE_NAME,
REPOSITORY);
-
- private static final String WORKSPACE_PATH = "/myproject/myfolder/";
//$NON-NLS-1$
- private static final String FILE_PATH = WORKSPACE_PATH + "document.txt";
//$NON-NLS-1$
-
- //
===========================================================================================================================
- // Fields
- //
===========================================================================================================================
-
- private JsonRestClient restClient;
-
- private ServerManager serverManager;
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- @Before
- public void beforeEach() {
- this.restClient = new JsonRestClient();
- this.serverManager = new ServerManager(null, this.restClient);
- this.serverManager.addServer(SERVER);
- }
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- @Test
- public void shouldAllowServerPropertiesToChange() {
- // TODO implement shouldAllowServerPropertiesToChange()
- }
-
-// @Test
- public void shouldGetRepositories() throws Exception {
- Collection<Repository> repositories =
this.serverManager.getRepositories(SERVER);
- assertThat(repositories.size(), is(1));
- }
-
-// @Test
- public void shouldGetWorkspaces() throws Exception {
- Collection<Workspace> workspaces =
this.serverManager.getWorkspaces(REPOSITORY);
- assertThat(workspaces.size(), is(1));
- }
-
-// @Test
- public void shouldPublish() throws Exception {
- URL textFile = getClass().getResource(FILE_PATH);
- assertThat(textFile, is(notNullValue()));
-
- // publish
- File file = new File(textFile.toURI());
- assertThat(this.serverManager.publish(WORKSPACE, WORKSPACE_PATH, file).isOk(),
is(true));
-
- // confirm it exists in repository
- assertThat((this.restClient).pathExists(WORKSPACE, WORKSPACE_PATH, file),
is(true));
- }
-
- @Test
- public void shouldUnpublish() {
- // TODO implement shouldUnpublish()
- }
-
-}
Deleted:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/ServerManagerTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -1,276 +0,0 @@
-/*
- * JBoss DNA (
http://www.jboss.org/dna)
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- * See the AUTHORS.txt file in the distribution for a full listing of
- * individual contributors.
- *
- * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
- * is licensed to you under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * JBoss DNA is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jboss.dna.web.jcr.rest.client;
-
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertThat;
-import org.jboss.dna.web.jcr.rest.client.domain.Repository;
-import org.jboss.dna.web.jcr.rest.client.domain.Server;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * The <code>ServerManagerTest</code> class is a test class for the {@link
ServerManager server manager} object.
- */
-public final class ServerManagerTest {
-
- //
===========================================================================================================================
- // Constants
- //
===========================================================================================================================
-
- private static final String URL1 = "file:/tmp/temp.txt"; //$NON-NLS-1$
- private static final String URL2 = "http:www.redhat.com"; //$NON-NLS-1$
-
- private static final String USER1 = "user1"; //$NON-NLS-1$
- private static final String USER2 = "user2"; //$NON-NLS-1$
-
- private static final String PSWD1 = "pwsd1"; //$NON-NLS-1$
- private static final String PSWD2 = "pwsd2"; //$NON-NLS-1$
-
- private static Server SERVER1 = new Server(URL1, USER1, PSWD1, false);
- private static Server SERVER1_UPDATE = new Server(SERVER1.getUrl(),
SERVER1.getUser(), SERVER1.getPassword(),
-
SERVER1.isPasswordBeingPersisted());
- private static Server SERVER2 = new Server(URL2, USER2, PSWD2,
!SERVER1.isPasswordBeingPersisted());
-
- //
===========================================================================================================================
- // Fields
- //
===========================================================================================================================
-
- private ServerManager serverManager;
-
- //
===========================================================================================================================
- // Methods
- //
===========================================================================================================================
-
- @Before
- public void beforeEach() {
- this.serverManager = new ServerManager(null, new MockRestClient());
- }
-
- //
===========================================================================================================================
- // Tests
- //
===========================================================================================================================
-
- @Test
- public void shouldBeRegisteredIfAdded() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.isRegistered(SERVER1), is(true));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldBeRegisteredIfServerWithSameKeyHasBeenAdded() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.isRegistered(new Server(SERVER1.getUrl(),
SERVER1.getUser(), PSWD2,
-
!SERVER1.isPasswordBeingPersisted())), is(true));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldDecreaseRegistrySizeWhenServerRemoved() {
- this.serverManager.addServer(SERVER1);
- this.serverManager.addServer(SERVER2);
-
- this.serverManager.removeServer(SERVER1);
- assertThat(this.serverManager.getServers().size(), is(1));
-
- this.serverManager.removeServer(SERVER2);
- assertThat(this.serverManager.getServers().isEmpty(), is(true));
- }
-
- @Test
- public void shouldHaveOkStatusWhenAddingServerSuccessfully() {
- assertThat(this.serverManager.addServer(SERVER1).isOk(), is(true));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldHaveOkStatusWhenRemovingServerSuccessfully() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(true));
- assertThat(this.serverManager.getServers().isEmpty(), is(true));
- }
-
- @Test
- public void shouldHaveOkStatusWhenUpdateServerSuccessfully() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.updateServer(SERVER1, SERVER1_UPDATE).isOk(),
is(true));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldIncreaseRegistrySizeWhenServerAdded() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.getServers().size(), is(1));
-
- this.serverManager.addServer(SERVER2);
- assertThat(this.serverManager.getServers().size(), is(2));
- }
-
- @Test
- public void shouldNotAddServerIfAlreadyAdded() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.addServer(SERVER1).isOk(), is(false));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldNotAddServerIfKeysMatch() {
- this.serverManager.addServer(SERVER1);
- Status status = this.serverManager.addServer(new Server(SERVER1.getUrl(),
SERVER1.getUser(), PSWD2,
-
!SERVER1.isPasswordBeingPersisted()));
- assertThat(status.isOk(), is(false));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldNotBeRegisteredIfNotAdded() {
- this.serverManager.addServer(SERVER1);
- assertThat(this.serverManager.isRegistered(SERVER2), is(false));
- assertThat(this.serverManager.getServers().size(), is(1));
- }
-
- @Test
- public void shouldNotBeRegisteredIfRemoved() {
- this.serverManager.addServer(SERVER1);
- this.serverManager.removeServer(SERVER1);
- assertThat(this.serverManager.isRegistered(SERVER1), is(false));
- assertThat(this.serverManager.getServers().isEmpty(), is(true));
- }
-
- @Test
- public void shouldNotReceiveNotificationIfListenerUnregistered() {
- RegistryListener listener = new RegistryListener();
-
- this.serverManager.addRegistryListener(listener);
- this.serverManager.removeRegistryListener(listener);
- this.serverManager.addServer(SERVER1);
- assertThat(listener.wasNotified(), is(false));
- }
-
- @Test
- public void shouldNotRemoveServerIfNotAdded() {
- assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(false));
- assertThat(this.serverManager.getServers().isEmpty(), is(true));
- }
-
- @Test( expected = RuntimeException.class )
- public void shouldNotObtainRepositoriesForUnregisteredServer() throws Exception {
- this.serverManager.getRepositories(SERVER1);
- }
-
- @Test( expected = RuntimeException.class )
- public void shouldNotObtainWorkspacesForUnregisteredServer() throws Exception {
- Repository repository = new Repository("repo", SERVER1);//$NON-NLS-1$
- this.serverManager.getWorkspaces(repository);
- }
-
- @Test
- public void shouldReceiveOneEventIfRegisteredMoreThanOnce() {
- RegistryListener listener = new RegistryListener();
- this.serverManager.addRegistryListener(listener);
- this.serverManager.addRegistryListener(listener);
-
- this.serverManager.addServer(SERVER1);
- assertThat(listener.wasNotified(), is(true));
- }
-
- @Test
- public void shouldReceiveNotificationIfRegisteredListener() {
- RegistryListener listener = new RegistryListener();
- assertThat(this.serverManager.addRegistryListener(listener), is(true));
-
- this.serverManager.addServer(SERVER1);
- assertThat(listener.wasNotified(), is(true));
- }
-
- @Test
- public void shouldReceiveNewServerEvent() {
- RegistryListener listener = new RegistryListener();
- this.serverManager.addRegistryListener(listener);
-
- this.serverManager.addServer(SERVER1);
- assertThat(listener.getEvent().isNew(), is(true));
- assertThat(listener.getEvent().isRemove(), is(false));
- assertThat(listener.getEvent().isUpdate(), is(false));
- }
-
- @Test
- public void shouldReceiveRemoveServerEvent() {
- this.serverManager.addServer(SERVER1);
-
- RegistryListener listener = new RegistryListener();
- this.serverManager.addRegistryListener(listener);
-
- this.serverManager.removeServer(SERVER1);
- assertThat(listener.getEvent().isRemove(), is(true));
- assertThat(listener.getEvent().isNew(), is(false));
- assertThat(listener.getEvent().isUpdate(), is(false));
- }
-
- @Test
- public void shouldReceiveUpdateServerEvent() {
- this.serverManager.addServer(SERVER1);
-
- RegistryListener listener = new RegistryListener();
- this.serverManager.addRegistryListener(listener);
-
- this.serverManager.updateServer(SERVER1, new Server(SERVER1.getUrl(),
SERVER1.getUser(), PSWD2,
-
!SERVER1.isPasswordBeingPersisted()));
- assertThat(listener.getEvent().isUpdate(), is(true));
- assertThat(listener.getEvent().isNew(), is(false));
- assertThat(listener.getEvent().isRemove(), is(false));
- }
-
- @Test
- public void shouldRemoveServerIfNotAddedButKeyMatches() {
- this.serverManager.addServer(SERVER1_UPDATE);
- assertThat(this.serverManager.removeServer(SERVER1).isOk(), is(true));
- assertThat(this.serverManager.getServers().isEmpty(), is(true));
- }
-
- //
===========================================================================================================================
- // RegistryListener Inner Class
- //
===========================================================================================================================
-
- class RegistryListener implements IServerRegistryListener {
- boolean[] notified = new boolean[] {false};
- ServerRegistryEvent event = null;
-
- public Exception[] serverRegistryChanged( ServerRegistryEvent event ) {
- notified[0] = !notified[0];
- this.event = event;
- return null;
- }
-
- public ServerRegistryEvent getEvent() {
- return this.event;
- }
-
- public boolean wasNotified() {
- return notified[0];
- }
- }
-
-}
Modified:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/RepositoryTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -44,9 +44,9 @@
private static final String NAME2 = "name2"; //$NON-NLS-1$
- private static final Server SERVER1 = new Server("file:/tmp/temp.txt",
"user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final Server SERVER1 = new Server("file:/tmp/temp.txt",
"user", "pswd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- private static final Server SERVER2 = new Server("http:www.redhat.com",
"user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final Server SERVER2 = new Server("http:www.redhat.com",
"user", "pswd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1);
Modified:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/ServerTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -49,7 +49,7 @@
private static final String PSWD1 = "pwsd1"; //$NON-NLS-1$
private static final String PSWD2 = "pwsd2"; //$NON-NLS-1$
- private static Server SERVER1 = new Server(URL1, USER1, PSWD1, false);
+ private static Server SERVER1 = new Server(URL1, USER1, PSWD1);
//
===========================================================================================================================
// Tests
@@ -57,65 +57,43 @@
@Test
public void shouldBeEqualIfHavingSameProperies() {
- assertThat(SERVER1, equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(),
SERVER1.getPassword(),
- SERVER1.isPasswordBeingPersisted())));
+ assertThat(SERVER1, equalTo(new Server(SERVER1.getUrl(), SERVER1.getUser(),
SERVER1.getPassword())));
}
@Test
public void shouldHashToSameValueIfEquals() {
Set<Server> set = new HashSet<Server>();
set.add(SERVER1);
- set.add(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword(),
SERVER1.isPasswordBeingPersisted()));
+ set.add(new Server(SERVER1.getUrl(), SERVER1.getUser(), SERVER1.getPassword()));
assertThat(set.size(), equalTo(1));
}
@Test( expected = RuntimeException.class )
public void shouldNotAllowNullUrl() {
- new Server(null, USER1, PSWD1, true);
+ new Server(null, USER1, PSWD1);
}
@Test
public void shouldHaveSameKey() {
- assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), SERVER1.getUser(),
SERVER1.getPassword(),
- SERVER1.isPasswordBeingPersisted())),
is(true));
+ assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), SERVER1.getUser(),
SERVER1.getPassword())), is(true));
}
@Test
public void shouldNotBeEqualIfPropertiesAreDifferent() {
// different URL
- assertThat(SERVER1, is(not(equalTo(new Server(URL2, SERVER1.getUser(),
SERVER1.getPassword(),
-
SERVER1.isPasswordBeingPersisted())))));
+ assertThat(SERVER1, is(not(equalTo(new Server(URL2, SERVER1.getUser(),
SERVER1.getPassword())))));
// different user
- assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(), USER2,
SERVER1.getPassword(),
-
SERVER1.isPasswordBeingPersisted())))));
+ assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(), USER2,
SERVER1.getPassword())))));
- // different passord
- assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(),
SERVER1.getUser(), PSWD2,
-
SERVER1.isPasswordBeingPersisted())))));
-
- // different persisted flag
- assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(),
SERVER1.getUser(), SERVER1.getPassword(),
-
!SERVER1.isPasswordBeingPersisted())))));
+ // different password
+ assertThat(SERVER1, is(not(equalTo(new Server(SERVER1.getUrl(),
SERVER1.getUser(), PSWD2)))));
}
@Test
public void shouldNotHaveSameKey() {
- assertThat(SERVER1.hasSameKey(new Server(URL2, SERVER1.getUser(),
SERVER1.getPassword(),
- SERVER1.isPasswordBeingPersisted())),
is(false));
- assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), USER2,
SERVER1.getPassword(),
- SERVER1.isPasswordBeingPersisted())),
is(false));
+ assertThat(SERVER1.hasSameKey(new Server(URL2, SERVER1.getUser(),
SERVER1.getPassword())), is(false));
+ assertThat(SERVER1.hasSameKey(new Server(SERVER1.getUrl(), USER2,
SERVER1.getPassword())), is(false));
}
- @Test
- public void shouldSetPersistPasswordCorrectly() {
- boolean persist = true;
- Server server = new Server(URL1, USER1, PSWD1, persist);
- assertThat(persist, is(server.isPasswordBeingPersisted()));
-
- persist = !persist;
- server = new Server(URL1, USER1, PSWD1, persist);
- assertThat(persist, is(server.isPasswordBeingPersisted()));
- }
-
}
Modified:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/domain/WorkspaceTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -44,9 +44,9 @@
private static final String NAME2 = "name2"; //$NON-NLS-1$
- private static final Server SERVER1 = new Server("file:/tmp/temp.txt",
"user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final Server SERVER1 = new Server("file:/tmp/temp.txt",
"user", "pswd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- private static final Server SERVER2 = new Server("http:www.redhat.com",
"user", "pswd", false); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static final Server SERVER2 = new Server("http:www.redhat.com",
"user", "pswd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
private static final Repository REPOSITORY1 = new Repository(NAME1, SERVER1);
Modified:
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java
===================================================================
---
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-12-18
20:48:51 UTC (rev 1459)
+++
trunk/web/dna-web-jcr-rest-client/src/test/java/org/jboss/dna/web/jcr/rest/client/json/JsonRestClientTest.java 2009-12-18
20:56:07 UTC (rev 1460)
@@ -55,7 +55,7 @@
private static final String PSWD = "password"; //$NON-NLS-1$
private static final String USER = "dnauser"; //$NON-NLS-1$
- private static final Server SERVER = new Server("http://localhost:8080",
USER, PSWD, false); //$NON-NLS-1$
+ private static final Server SERVER = new Server("http://localhost:8080",
USER, PSWD); //$NON-NLS-1$
private static final String REPOSITORY_NAME = "dna:repository";
//$NON-NLS-1$
private static final Repository REPOSITORY1 = new Repository(REPOSITORY_NAME,
SERVER);
private static final String WORKSPACE_NAME = "default"; //$NON-NLS-1$