Some of the things Andy does are examples of all three; in other words, his actions in general demonstrate all three of these qualities. I did read the short story long ago, but am more familiar with the movie, so I'm not sure if all the elements I'm going to mention were also in the written form.
Andy spends many years tunneling with a rock hammer. To do such a thing shows perseverance, optimism and courage; he doesn't know for sure that he will ever be able to break all the way through, it takes him many years to do it, and he could be caught at any time, if the guards ever take down his posters.
Andy continues to push for improvements to the library. Again, this shows all three character traits. He has to try repeatedly in the face of refusals, and he risks bringing down the wrath of the warden for continuing to try.
Andy buries the box by the fence after he escapes. He has to trust that his friend will be released, that he will believe Andy enough to find the box, and be courageous enough to stick around long enough to bury it.
Last but not least, Andy always continues to believe that he will be a free man, and finds a way to bring down evil (the warden) as well.