package me.haosdent.cgroup.subsystem;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class CommonTest {

  @Before
  public void setUp() {}

  @After
  public void tearDown() {}

  @Test
  public void testAddTask() {}

  @Test
  public void testSetEventControl() {}

  @Test
  public void testSetNotifyOnRelease() {}

  @Test
  public void testSetReleaseAgent() {}
}

@@ -43,57 +43,284 @@
 ort 
-org.junit.After;%0Aimport org.junit.Before
+me.haosdent.cgroup.manage.Admin;%0Aimport me.haosdent.cgroup.manage.Group;%0Aimport me.haosdent.cgroup.util.Constants;%0Aimport me.haosdent.cgroup.util.Threads;%0Aimport org.junit.*;%0Aimport org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0Aimport java.io.IOException
 ;%0A
+%0A
 import 
+static 
 org.
@@ -329,153 +329,1083 @@
 nit.
-Test;%0A%0Apublic class CommonTest %7B%0A%0A  @Before%0A  public void setUp() %7B%7D%0A%0A  @After%0A  public void tearDown() %7B%7D%0A%0A  @Test%0A  public void testAddTask() %7B
+Assert.*;%0A%0Apublic class CommonTest %7B%0A%0A  private static final Logger LOG = LoggerFactory.getLogger(CommonTest.class);%0A  private static Admin admin;%0A  private static Group root;%0A  private static Group one;%0A  private static Group two;%0A%0A  @BeforeClass%0A  public static void setUpClass() %7B%0A    try %7B%0A      admin = new Admin(Constants.SUBSYS_CPU);%0A      root = admin.getRootGroup();%0A      one = admin.createGroup(%22one%22, Constants.SUBSYS_CPU);%0A      two = admin.createGroup(%22two%22, Constants.SUBSYS_CPU);%0A    %7D catch (IOException e) %7B%0A      LOG.error(%22Create cgroup Failed.%22, e);%0A      assertTrue(false);%0A    %7D%0A  %7D%0A%0A  @AfterClass%0A  public static void tearDownClass() %7B%0A    try %7B%0A      admin.umount();%0A    %7D catch (IOException e) %7B%0A      LOG.error(%22Umount cgroup failed.%22, e);%0A    %7D%0A  %7D%0A%0A  @Before%0A  public void setUp() %7B%7D%0A%0A  @After%0A  public void tearDown() %7B%7D%0A%0A  @Test%0A  public void testAddTask() %7B%0A    try %7B%0A      int tid = Threads.getThreadId();%0A      one.getCpu().addTask(tid);%0A    %7D catch (IOException e) %7B%0A      LOG.error(%22Add task failed.%22, e);%0A      assertTrue(false);%0A    %7D%0A  
 %7D%0A%0A 
@@ -1444,24 +1444,38 @@
 tControl() %7B
+%0A    //TODO%0A  
 %7D%0A%0A  @Test%0A 
@@ -1517,56 +1517,575 @@
 () %7B
-%7D%0A%0A  @Test%0A  public void testSetReleaseAgent() %7B
+%0A    try %7B%0A      one.getCpu().setNotifyOnRelease(true);%0A      assertTrue(one.getCpu().isNotifyOnRelease());%0A    %7D catch (IOException e) %7B%0A      LOG.error(%22Set notify_on_release failed.%22, e);%0A      assertTrue(false);%0A    %7D%0A  %7D%0A%0A  @Test%0A  public void testSetReleaseAgent() %7B%0A    try %7B%0A      String excepted = %22echo 0%22;%0A      one.getCpu().setReleaseAgent(excepted);%0A      String actual = one.getCpu().getReleaseAgent();%0A      assertEquals(actual, excepted);%0A    %7D catch (IOException e) %7B%0A      LOG.error(%22Set release_agent failed.%22, e);%0A      assertTrue(false);%0A    %7D%0A  
 %7D%0A%7D%0A

Implement test cases in CommonTest.java