There is another, definitely less good way, to find the expectation. Let us analyze the distribution of the random variable $X$. The part before $0$ is harmless.
For $0\le x\lt 1$, the cumulative distribution function is $x/2$, nice and familiar, the density function is the derivative of the the cdf, which is $1/2$.
At $1$, and all the way up to but not including $2$, the cdf is $2/3$. So there is a sudden jump at $x=1$. As we approach $1$ from the left, the cdf approaches $1/2$, but all of a sudden it is $2/3$ at $1$, and then stays at that all the way to, but not including $2$. What that means is that there is a discrete "weight" of $2/3-1/2$ at $x=1$: $\Pr(X=1)=2/3-1/2=1/6$.
The cdf takes another sudden jump to $11/12$ at $2$. That means we have a weight of $11/12-2/3$, that is, $3/12$, at $x=2$.
Finally, there is another weight of $1/12$ at $x=3$.
To sum up, this is a mixed continuous-discrete situation: there is a continuous uniform distribution, density $1/2$, between $0$ and $1$. In addition, $\Pr(X=1)=1/6$, $\Pr(X=2)=3/12$, and $\Pr(X=3)=1/12$. The moment about the origin (mean) is therefore
$$\int_0^1 x\cdot\frac{1}{2}\,dx+ 1\cdot\frac{1}{6}+2\cdot \frac{3}{12}+3\cdot \frac{1}{12}.$$
I think this simplifies to $\dfrac{7}{6}$. You might want to compare that with the result you get from doing it the full integration way. The latter approach is the one you should become comfortable with.