summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/openslx/vm/disk/DiskImageVdiTest.java
blob: 492c6aaffb26bf01bd85384ca8d77933928568ba (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
package org.openslx.vm.disk;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.IOException;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.openslx.vm.disk.DiskImage.ImageFormat;

public class DiskImageVdiTest
{
	@Test
	@DisplayName( "Test detection of default VDI disk image" )
	public void testVdiDiskImage() throws DiskImageException, IOException
	{
		final DiskImage image = DiskImage.newInstance( DiskImageTestResources.getDiskFile( "image-default.vdi" ) );
		final int imageVersion = DiskImageUtils.versionFromMajorMinor( Short.valueOf( "1" ), Short.valueOf( "1" ) );

		assertEquals( ImageFormat.VDI.toString(), image.getFormat().toString() );
		assertEquals( true, image.isStandalone() );
		assertEquals( false, image.isSnapshot() );
		assertEquals( false, image.isCompressed() );
		assertEquals( imageVersion, image.getVersion() );
		assertNotNull( image.getDescription() );
	}
	
	@Test
	@DisplayName( "Test detection of VDI disk image snapshot" )
	public void testVdiDiskImageSnapshot() throws DiskImageException, IOException
	{
		final DiskImage image = DiskImage.newInstance( DiskImageTestResources.getDiskFile( "image-default_snapshot.vdi" ) );
		final int imageVersion = DiskImageUtils.versionFromMajorMinor( Short.valueOf( "1" ), Short.valueOf( "1" ) );

		assertEquals( ImageFormat.VDI.toString(), image.getFormat().toString() );
		assertEquals( true, image.isStandalone() );
		assertEquals( true, image.isSnapshot() );
		assertEquals( false, image.isCompressed() );
		assertEquals( imageVersion, image.getVersion() );
		assertNotNull( image.getDescription() );
	}
}