PortalKit: remove test parts in javacodes, and move build-content logic code to a separated file.