  We study the dynamics of one-dimensional bosons trapped in a box potential,
in the presence of a barrier creating a tunable weak-link, thus realizing a one
dimensional Bose Josephson junction. By varying the initial population
imbalance and the barrier height we evidence different dynamical regimes. In
particular we show that at large barriers a two mode model captures accurately
the dynamics, while for low barriers the dynamics involves dispersive shock
waves and solitons. We study a quench protocol that can be readily implemented
in experiments and show that self-trapping resonances can occur. This
phenomenon can be understood qualitatively within the two-mode model.
