MachineDetailsDocumentConverter { public SpaceDocument toDocument(final MachineDetails md) { if (md == null) { return null; } final PersistentMachineDetails pmd = new PersistentMachineDetails(); pmd.populateFromMachineDetails(md); final SpaceDocument document = com.gigaspaces.document.DocumentObjectConverter.instance().toSpaceDocument(pmd); return document; }  SpaceDocument toDocument(final MachineDetails md); MachineDetails toMachineDetails(final SpaceDocument document);  }
@Test public void testToDocument_1() throws Exception { MachineDetailsDocumentConverter fixture = new MachineDetailsDocumentConverter(); MachineDetails md = null; SpaceDocument result = fixture.toDocument(md); assertEquals(null, result); }
@Test public void testToDocument_2() throws Exception { MachineDetailsDocumentConverter fixture = new MachineDetailsDocumentConverter(); MachineDetails md = new MachineDetails(); SpaceDocument result = fixture.toDocument(md); assertNotNull(result); assertEquals( "SpaceDocument [typeName=org.cloudifysource.esc.driver.provisioning.PersistentMachineDetails, version=0, transient=false, properties=DocumentProperties {publicAddress=null,cloudifyInstalled=false,environment={},installationDirectory=null,privateAddress=null,keyFileName=null,locationId=null,cleanRemoteDirectoryOnStart=false,machineId=null,remoteDirectory=null,remoteExecutionMode=SSH,keyFile=null,openFilesLimit=null,attachedVolumeId=null,fileTransferMode=SFTP,remotePassword=null,remoteUsername=null,agentRunning=false,scriptLangeuage=LINUX_SHELL}]", result.toString()); assertEquals("org.cloudifysource.esc.driver.provisioning.PersistentMachineDetails", result.getTypeName()); assertEquals(false, result.isTransient()); assertEquals(0, result.getVersion()); }