<commit_before>package org.openstack.client.compute;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.openstack.model.compute.Volume;
import org.openstack.model.compute.VolumeList;
import org.openstack.model.compute.nova.volume.NovaVolumeAttachment;
import org.openstack.model.compute.nova.volume.NovaVolumeForCreate;
import org.testng.annotations.Test;

public class ITSnapshots extends ComputeIntegrationTest {
	
	private Volume volume;

	@Test
	public void listVolumes() {
		VolumeList volumes = compute.volumes().get();
	}
	
	@Test
	public void createVolume() throws Exception {
		NovaVolumeForCreate nv = new NovaVolumeForCreate();
		nv.setName("v2");
		nv.setSizeInGB(1);
		volume = compute.volumes().post(nv);
		System.out.println(volume);
		waitForState("available");
	}
	
	@Test(dependsOnMethods="createVolume", priority=1)
	public void showVolume() throws Exception {
		volume = compute.volumes().volume(volume.getId()).get();
		System.out.println(volume);	
	}
	
	@Test(dependsOnMethods="createVolume", priority=1000)
	public void deleteVolume() {
		compute.volumes().volume(volume.getId()).delete();
	}
	
	public void createVolumeAttachment() {
		NovaVolumeAttachment attachment = new NovaVolumeAttachment();
		attachment.setVolumeId(volume.getId());
		attachment.setDevice("/mnt");
		compute.servers().server("").attachments().post(attachment);
	}
	
	public void deleteVolumeAttachment() {
		compute.servers().server("").attachments().attachment(volume.getId()).delete();
	}
	
	private void waitForState(final String state) {
		try {
			final ScheduledThreadPoolExecutor timer = new ScheduledThreadPoolExecutor(1);
			timer.scheduleAtFixedRate(new Runnable() {
				
				@Override
				public void run() {
					volume = compute.volumes().volume(volume.getId()).get();
					if(state.equals(volume.getStatus())) {
						timer.shutdown();
					} else {
						System.out.print(".");
					}
				}
			}, 3, 1, TimeUnit.SECONDS);
			timer.awaitTermination(30, TimeUnit.SECONDS);
		} catch (Exception e) {
			
		}
		
	}
	
}<commit_msg>last minute changes ;)<commit_after>package org.openstack.client.compute;

import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import org.openstack.model.compute.Snapshot;
import org.openstack.model.compute.SnapshotList;
import org.openstack.model.compute.nova.volume.NovaSnapshotAttachment;
import org.openstack.model.compute.nova.volume.NovaSnapshotForCreate;
import org.testng.annotations.Test;

public class ITSnapshots extends ComputeIntegrationTest {
	
	private Snapshot volume;

	@Test
	public void listSnapshots() {
		SnapshotList volumes = compute.volumes().get();
	}
	
	@Test
	public void createSnapshot() throws Exception {
		NovaSnapshotForCreate nv = new NovaSnapshotForCreate();
		nv.setName("v2");
		nv.setSizeInGB(1);
		volume = compute.volumes().post(nv);
		System.out.println(volume);
		waitForState("available");
	}
	
	@Test(dependsOnMethods="createSnapshot", priority=1)
	public void showSnapshot() throws Exception {
		volume = compute.volumes().volume(volume.getId()).get();
		System.out.println(volume);	
	}
	
	@Test(dependsOnMethods="createSnapshot", priority=1000)
	public void deleteSnapshot() {
		compute.volumes().volume(volume.getId()).delete();
	}
	
	private void waitForState(final String state) {
		try {
			final ScheduledThreadPoolExecutor timer = new ScheduledThreadPoolExecutor(1);
			timer.scheduleAtFixedRate(new Runnable() {
				
				@Override
				public void run() {
					volume = compute.snapshots().snapshot(volume.getId()).get();
					if(state.equals(volume.getStatus())) {
						timer.shutdown();
					} else {
						System.out.print(".");
					}
				}
			}, 3, 1, TimeUnit.SECONDS);
			timer.awaitTermination(30, TimeUnit.SECONDS);
		} catch (Exception e) {
			
		}
		
	}
	
}
{'fraction_non_alphanumeric': 0.13419689119170986, 'fraction_numerical': 0.0062176165803108805, 'mean_word_length': 4.669603524229075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2372349', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1178, 'n_words': 205}