The Battle of the Cowshed represents Leon Trotsky's unification of the Russian army and his military victories over occupying Germany. In reality, Germany tried to invade Russia, and was only repelled when Trotsky led the Soviet army in several battles. Snowball, who represents Trotsky, is the one who sees the human attack coming, and prepares the farm for it.
This had long been expected, and all preparations had been made. Snowball, who had studied an old book of Julius Caesar's campaigns which he had found in the farmhouse, was in charge of the defensive operations.
(Orwell, Animal Farm, msxnet.org)
It is telling that Napoleon plays little part in this battle, but later claims to have been a decisive fighter and awards himself medals based on nothing. Like Stalin, who took credit for Trotsky's successes while vilifying him, Napoleon allows others to take the risks and he assumes the credit.