summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/openslx/imagemaster/AppTest.java
blob: de18faa211c457691fe848c556ec07862aeb154c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package org.openslx.imagemaster;

import java.util.UUID;

import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.openslx.imagemaster.serverconnection.ImageProcessor;
import org.openslx.imagemaster.thrift.iface.ImageData;
import org.openslx.imagemaster.thrift.iface.UploadInfos;
import org.openslx.imagemaster.util.Sha512Crypt;

/**
 * Unit test for simple App.
 */
public class AppTest extends TestCase
{

	/**
	 * Create the test case
	 * 
	 * @param testName name of the test case
	 */
	public AppTest(String testName)
	{
		super( testName );
	}

	/**
	 * @return the suite of tests being tested
	 */
	public static Test suite()
	{
		return new TestSuite( AppTest.class );
	}

	/**
	 * Rigourous Test :-)
	 */
	public void testApp()
	{
		assertTrue( true );
	}

	public void testSha512_Crypt()
	{
		Sha512Crypt.selfTest();
	}
	
	/* Fails...
	public void testImageProcessor() {
		ImageData imageData = new ImageData(UUID.randomUUID().toString(), 1, "windows7.vmdk",
				System.currentTimeMillis(), System.currentTimeMillis(), "ns202@uni-freiburg.de", "win7",
				true, false, "Windows 7", "Das ist ein tolles Windows 7", 40*16*1024*1024L);	// exactly 40 blocks
		
		UploadInfos uploadInfos = ImageProcessor.getUploadInfos( "asdfasdfasdf", imageData );
		assertEquals( "Not the right number of blocks", 20, uploadInfos.missingBlocks.size() );
		for (int i = 0; i < uploadInfos.missingBlocks.size(); i++) {
			assertEquals(i, uploadInfos.missingBlocks.remove( 0 ).intValue());
		}
		
		String token = uploadInfos.getToken();
		
		uploadInfos = ImageProcessor.getUploadInfos( "asdfasdfasdf", imageData );
		assertEquals( "Not the right number of blocks", 20, uploadInfos.missingBlocks.size() );
		for (int i = 0; i < uploadInfos.missingBlocks.size(); i++) {
			assertEquals(i, uploadInfos.missingBlocks.remove( 0 ).intValue());
		}
		
		assertEquals("Wrong token was sent back.", token, uploadInfos.getToken());
	}
	*/
}