Skip to content

Commit

Permalink
Fixed wrong context configuration for non-interactive shell mode (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vania-pooh committed Jan 27, 2017
1 parent d573e6b commit 47a9933
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.meridor.perspective.shell.common.misc;
package org.meridor.perspective.shell.interactive;

public interface CommandExecutor {

void execute(String command);

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.meridor.perspective.shell.interactive.commands;

import org.meridor.perspective.shell.common.misc.CommandExecutor;
import org.meridor.perspective.shell.common.repository.ImagesRepository;
import org.meridor.perspective.shell.common.repository.InstancesRepository;
import org.meridor.perspective.shell.common.request.AddImagesRequest;
import org.meridor.perspective.shell.common.request.AddInstancesRequest;
import org.meridor.perspective.shell.common.request.RequestProvider;
import org.meridor.perspective.shell.interactive.CommandExecutor;
import org.meridor.perspective.shell.interactive.wizard.images.AddImagesWizard;
import org.meridor.perspective.shell.interactive.wizard.instances.add.AddInstancesWizard;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.meridor.perspective.shell.interactive.commands;

import org.meridor.perspective.config.OperationType;
import org.meridor.perspective.shell.common.misc.CommandExecutor;
import org.meridor.perspective.shell.common.misc.DateUtils;
import org.meridor.perspective.shell.common.misc.OperationSupportChecker;
import org.meridor.perspective.shell.common.repository.ImagesRepository;
Expand All @@ -16,6 +15,7 @@
import org.meridor.perspective.shell.common.result.FindFlavorsResult;
import org.meridor.perspective.shell.common.result.FindImagesResult;
import org.meridor.perspective.shell.common.result.FindInstancesResult;
import org.meridor.perspective.shell.interactive.CommandExecutor;
import org.meridor.perspective.shell.interactive.wizard.instances.rebuild.RebuildInstancesWizard;
import org.meridor.perspective.shell.interactive.wizard.instances.resize.ResizeInstancesWizard;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package org.meridor.perspective.shell.common.misc.impl;
package org.meridor.perspective.shell.interactive.impl;

import org.meridor.perspective.shell.common.misc.CommandExecutor;
import org.meridor.perspective.shell.common.misc.Logger;
import org.meridor.perspective.shell.interactive.CommandExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.shell.core.Shell;
import org.springframework.stereotype.Component;

@Component
public class CommandExecutorImpl implements CommandExecutor {

@Autowired
private Shell shell;

@Autowired
private Logger logger;

@Override
public void execute(String command) {
logger.ok(String.format("Executing command: %s", command));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import org.junit.Test;
import org.junit.runner.RunWith;
import org.meridor.perspective.shell.common.misc.CommandExecutor;
import org.meridor.perspective.shell.interactive.CommandExecutor;
import org.meridor.perspective.shell.interactive.MockShell;
import org.meridor.perspective.shell.interactive.TestLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
Expand All @@ -12,7 +13,7 @@
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;

@ContextConfiguration(locations = "/META-INF/spring/command-executer-context.xml")
@ContextConfiguration(locations = "/META-INF/spring/command-executor-context.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class CommandExecutorImplTest {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.meridor.perspective.shell.common.misc.impl;
package org.meridor.perspective.shell.interactive;

import org.springframework.shell.core.CommandResult;
import org.springframework.shell.core.ExitShellRequest;
Expand All @@ -14,9 +14,9 @@

@Component
public class MockShell implements Shell {

private final List<String> commands = new ArrayList<>();

@Override
public void promptLoop() {
throw new UnsupportedOperationException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
http://www.springframework.org/schema/beans/spring-beans-4.2.xsd">

<bean class="org.meridor.perspective.shell.interactive.TestLogger"/>
<bean class="org.meridor.perspective.shell.common.misc.impl.MockShell"/>
<bean class="org.meridor.perspective.shell.common.misc.impl.CommandExecutorImpl"/>
<bean class="org.meridor.perspective.shell.interactive.MockShell"/>
<bean class="org.meridor.perspective.shell.interactive.impl.CommandExecutorImpl"/>
</beans>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
<context:annotation-config/>
<context:component-scan base-package="org.meridor.perspective.shell;org.springframework.shell">
<context:exclude-filter expression="org\.meridor\.perspective\.shell\.common\.impl\.LoggerImpl" type="regex" />
<context:exclude-filter expression="org\.meridor\.perspective\.shell\.common\.misc\.impl\.MockShell" type="regex" />
<context:exclude-filter
expression="org\.meridor\.perspective\.shell\.interactive\.MockShell"
type="regex"/>
<context:exclude-filter expression="org\.meridor\.perspective\.shell\.common\.repository\.impl\..*" type="regex" />
<context:exclude-filter expression="org\.springframework\.shell\.plugin\.support\.DefaultPromptProvider" type="regex" />
</context:component-scan>
Expand Down

This file was deleted.

0 comments on commit 47a9933

Please sign in to comment.