Energy harvesting (EH) nodes can play an important role in cooperative communication systems which do not have a continuous power supply. In this paper, we consider the optimization of conventional and buffer-aided link adaptive EH relaying systems, where an EH source communicates with the destination via an EH decode-and-forward relay. In conventional relaying, source and relay transmit signals in consecutive time slots whereas in buffer-aided link adaptive relaying, the state of the source-relay and relay-destination channels determines whether the source or the relay is selected for transmission. Our objective is to maximize the system throughput over a finite number of transmission time slots for both relaying protocols. In case of conventional relaying, we propose an offline and several online joint source and relay transmit power allocation schemes. For offline power allocation, we formulate an optimization problem which can be solved optimally. For the online case, we propose a dynamic programming (DP) approach to compute the optimal online transmit power. To alleviate the complexity inherent to DP, we also propose several suboptimal online power allocation schemes. For buffer-aided link adaptive relaying, we show that the joint offline optimization of the source and relay transmit powers along with the link selection results in a mixed integer non-linear program which we solve optimally using the spatial branch-and-bound method. We also propose an efficient online power allocation scheme and a naive online power allocation scheme for buffer-aided link adaptive relaying. Our results show that link adaptive relaying provides performance improvement over conventional relaying at the expense of a higher computational complexity.