usersession.setUserStatus(admin,"ocsptest",UserDataConstants.STATUS_NEW);
usersession.changeUser(admin, "ocsptest", "foo123", "C=SE,O=AnaTom,CN=OCSPTest",null,"ocsptest@anatom.se",false, SecConst.EMPTY_ENDENTITYPROFILE,SecConst.CERTPROFILE_FIXED_ENDUSER,SecConst.USER_ENDUSER,SecConst.TOKEN_SOFT_PEM,0,UserDataConstants.STATUS_NEW, caid);
    public void test02OcspGood() throws Exception {        log.debug(">test02OcspGood()");        // find a CA (TestCA?) create a user and generate his cert        // send OCSP req to server and get good response        // change status of cert to bad status        // send OCSP req and get bad status        // (send crap message and get good error)        // Make user that we know...        boolean userExists = false;        try {            usersession.addUser(admin,"ocsptest","foo123","C=SE,O=AnaTom,CN=OCSPTest",null,"ocsptest@anatom.se",false,SecConst.EMPTY_ENDENTITYPROFILE,SecConst.CERTPROFILE_FIXED_ENDUSER,SecConst.USER_ENDUSER,SecConst.TOKEN_SOFT_PEM,0,caid);            log.debug("created user: ocsptest, foo123, C=SE, O=AnaTom, CN=OCSPTest");        } catch (RemoteException re) {            if (re.detail instanceof DuplicateKeyException) {                userExists = true;            }        } catch (DuplicateKeyException dke) {            userExists = true;        }        if (userExists) {            log.debug("User ocsptest already exists.");            usersession.setUserStatus(admin,"ocsptest",UserDataConstants.STATUS_NEW);            log.debug("Reset status to NEW");        }        // Generate certificate for the new user        KeyPair keys = genKeys();        // user that we know exists...        ocspTestCert = (X509Certificate) remote.createCertificate(admin, "ocsptest", "foo123", keys.getPublic());        assertNotNull("Misslyckades skapa cert", ocspTestCert);        // And an OCSP request        OCSPReqGenerator gen = new OCSPReqGenerator();        gen.addRequest(new CertificateID(CertificateID.HASH_SHA1, cacert, ocspTestCert.getSerialNumber()));        OCSPReq req = gen.generate();        // Send the request and receive a singleResponse        SingleResp singleResp = sendOCSPPost(req.getEncoded());                CertificateID certId = singleResp.getCertID();        assertEquals("Serno in response does not match serno in request.", certId.getSerialNumber(), ocspTestCert.getSerialNumber());        Object status = singleResp.getCertStatus();        assertEquals("Status is not null (good)", status, null);        log.debug("<test02OcspGood()");    }