/**
 * Copyright 2014 Linagora, Université Joseph Fourier
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.roboconf.dm.rest.client;

import java.io.File;

import net.roboconf.dm.management.Manager;
import net.roboconf.dm.rest.client.test.RestTestUtils;

import org.junit.Test;

import com.sun.jersey.test.framework.AppDescriptor;
import com.sun.jersey.test.framework.JerseyTest;
import com.sun.jersey.test.framework.spi.container.TestContainerFactory;
import com.sun.jersey.test.framework.spi.container.grizzly2.web.GrizzlyWebTestContainerFactory;

/**
 * A simple server that runs the mocked API (for tests).
 * @author Vincent Zurczak - Linagora
 */
public class DebugServer extends JerseyTest {

	@Override
	protected AppDescriptor configure() {
		return RestTestUtils.buildTestDescriptor();
	}

	@Override
    public TestContainerFactory getTestContainerFactory() {
        return new GrizzlyWebTestContainerFactory();
    }

	@Test
	public void testApplications() throws Exception {

		// Mock everything we can.
		// Comment or un-comment if necessary.
		Manager.INSTANCE.cleanUpAll();

		Manager.INSTANCE.tryToChangeMessageServerIp("ec2-54-72-90-105.eu-west-1.compute.amazonaws.com");
		Manager.INSTANCE.loadNewApplication( new File( "/home/gibello/OpenPAAS/roboconf.OLD/core/TEST/appdir/WallTest" ));


//		Manager.INSTANCE.getAppNameToManagedApplication().clear();
//		Manager.INSTANCE.setIaasResolver( new TestIaasResolver());
//		Manager.INSTANCE.setMessagingClientFactory( new MessageServerClientFactory() {
//			@Override
//			public IMessageServerClient create() {
//				return new TestMessageServerClient();
//			}
//		});

		// And just wait...
		for( ;; ) {

		}
	}
}

@@ -1612,16 +1612,18 @@
 All();%0A%0A
+//
 %09%09Manage
@@ -1713,16 +1713,18 @@
 .com%22);%0A
+//
 %09%09Manage

Update DebugServer.java