cvs commit: spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/services CommandRegistryImplTestCase.java RegisterDownloadableComponentCommandTestCase.java SubmitComponentCommandTestCase.java
Mike Hogan <[email protected]> Mon, 10 Nov 2003 12:21:43 -0800
| Newsgroups | gmane.comp.java.spice.cvs |
|---|---|
| Message-ID | <[email protected]> |
hogie 03/11/10 12:21:43
Added: sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/services
CommandRegistryImplTestCase.java
RegisterDownloadableComponentCommandTestCase.java
SubmitComponentCommandTestCase.java
Log:
Preview release with plexus-utils components
Revision Changes Path
1.1 spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/services/CommandRegistryImplTestCase.java
Index: CommandRegistryImplTestCase.java
===================================================================
package org.componenthaus.repository.services;
import junit.framework.TestCase;
import org.componenthaus.tests.MockComponent;
import java.io.File;
public class CommandRegistryImplTestCase extends TestCase {
private CommandRegistry commandRegistry = null;
protected void setUp() throws Exception {
commandRegistry = new CommandRegistryImpl();
}
public void testCanCreateSubmitComponentCommand() {
assertNotNull(commandRegistry.createSubmitComponentCommand(new MockComponent("1")));
}
public void testCanCreateRegisterDownloadableCommand() {
assertNotNull(commandRegistry.createRegisterDownloadableCommand("1",new File("")));
}
}
1.1 spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/services/RegisterDownloadableComponentCommandTestCase.java
Index: RegisterDownloadableComponentCommandTestCase.java
===================================================================
package org.componenthaus.repository.services;
import junit.framework.TestCase;
import java.io.File;
import org.componenthaus.tests.MockComponentRepository;
public class RegisterDownloadableComponentCommandTestCase extends TestCase {
public void testCallsRepositoryProperly() throws Exception {
String componentId = "424";
File file = new File("");
RegisterDownloadableComponentCommand command = new RegisterDownloadableComponentCommand(componentId, file);
MockComponentRepository mockRepository = new MockComponentRepository();
mockRepository.setupExpectedRegisterDownloadable(componentId, file);
Object result = command.execute(mockRepository);
assertNull(result);
mockRepository.verify();
}
}
1.1 spice/sandbox/repository/componenthaus/src/tests/org/componenthaus/repository/services/SubmitComponentCommandTestCase.java
Index: SubmitComponentCommandTestCase.java
===================================================================
package org.componenthaus.repository.services;
import junit.framework.TestCase;
import org.componenthaus.tests.MockComponent;
import org.componenthaus.tests.MockComponentRepository;
public class SubmitComponentCommandTestCase extends TestCase {
public void testCallsRepositoryProperly() throws Exception {
MockComponent component = new MockComponent("23432");
SubmitComponentCommand command = new SubmitComponentCommand(component);
MockComponentRepository repository = new MockComponentRepository();
String preparedResult = "ajdklj";
repository.setupExpectedAddComponent(component, preparedResult);
Object result = command.execute(repository);
assertSame(preparedResult,result);
repository.verify();
}
}
-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/