North Korea is a complicated political issue for China.
Coming out from the dictatorship rule and isolation a quarter of century ago, almost all Chinese people strongly dislike the regime of North Korea. However, current China's influence on North Korea is very limited. A high ranking official of North Korea said several months ago that "We can not trust China and Russia." From the view point of national interest, China certainly does not want its neighbor country to have nuclear weapon.
Invasion of North Korea or overthrow of the regime by other means is surely not in the plan of Chinese government. The politics of three East Asia countries, China, Korea, and Japan is deeply rooted in history and is very complicated. Current Korean (both North and South) have strongest resentment toward Japan because pre-WWII Japanese colonial rule. Korean does not like Chinese either because China was the dominant power in the region in the history. China had military presence in Korea before the emerging Japan took over in the late 19th century. South Korean also sees the China's intervention in Korea war as the cause for Korea to miss the chance of reunification.
This is a good brief history lecture of Korea War (I posted before in Korea thread)
YouTube - korean war 1 of 2 YouTube - korean war 2 of 2
While China is currently largest trading partner for both North and South Korea, the Korean nationalistic sentiment to reduce China's influence is increasing because South Korean recent economic success. South Korea has recently changed its capital name used for over a thousand of years in Korean and Chinese language. Seoul means "Han City" in Korean and Chinese language. "Han" is a dynasty of China about 2000 years ago. 95% of Chinese are ethnic Han, which originated from Han Dynasty. The main river in Korea is called Han River, which South Korea is also planning to change its name.
From the national interest, China probably does not want to see North Korea to collapse. Currently, there are many refugees and illegal economic immigrants from North Korea in China. The collapse of North Korea could create bigger refugee problem. The other possible scenario is that collapse of North Korea will lead to the reunification of Korea. China does not have much concern about the reunification of Korea. What China may worry is that American military bases in South Korea may move northward after Korean reunification. There are currently about 37,000 American soldiers in South Korea. So, for China, North Korea is more than a dictator regime and it is a part of geopolitics.
I think that North Korea just wants to use the rocket and nuclear bomb to make big noise to cover up its economic failure and to get more bargaining chips in negotiation table for more economic aids. I guess that the North Korea issue will be solved after the death of its current leader. So the world has to wait patiently.