public void testValidateKickstartChannel() throws Exception { Channel base = ChannelTestUtils.createBaseChannel(user); Channel tools = ChannelTestUtils.createChildChannel(user, base); ksdata.getTree().setChannel(base); ksdata .getTree() .setInstallType( KickstartFactory.lookupKickstartInstallTypeByLabel(KickstartInstallType.RHEL_4)); assertFalse(ksdata.isRhel5()); assertFalse(helper.verifyKickstartChannel(ksdata, user)); PackageManagerTest.addPackageToChannel("rhn-kickstart", tools); assertFalse(helper.verifyKickstartChannel(ksdata, user)); ksdata .getTree() .setInstallType( KickstartFactory.lookupKickstartInstallTypeByLabel(KickstartInstallType.RHEL_5)); assertTrue(helper.verifyKickstartChannel(ksdata, user, false)); }
public void testKsViewLabel() { // URL: String url = "http://rhn.redhat.com/ks/cfg/org/" + user.getOrg().getId().toString() + "/view_label/" + ksdata.getLabel(); request.setAttribute(RequestContext.REQUESTED_URI, url); Map<String, Object> options = helper.parseKickstartUrl(url); assertNotNull(options.get("ksdata")); // This is the key test assertNull(options.get("session")); }
public void testProxyFetch() throws Exception { String proxyheader = "1006681409::1151513167.96:21600.0:VV/xFNEmCYOuHx" + "EBAs7BEw==:fjs-0-08.rhndev.redhat.com,1006681408::1151513034." + "3:21600.0:w2lm+XWSFJMVCGBK1dZXXQ==:fjs-0-11.rhndev.redhat.com" + ",1006678487::1152567362.02:21600.0:t15lgsaTRKpX6AxkUFQ11A==:f" + "js-0-12.rhndev.redhat.com"; // mockRequest.setupAddHeader(KickstartHelper.XRHNPROXYAUTH, proxyheader); mockRequest.setupGetHeader(KickstartHelper.XRHNPROXYAUTH, proxyheader); helper = new KickstartHelper(request); assertEquals("fjs-0-08.rhndev.redhat.com", helper.getKickstartHost()); }
public void testKsPathparse() { // URL: String url = "http://rhn.redhat.com/ks/cfg/org/" + user.getOrg().getId().toString() + "/label/" + ksdata.getLabel(); request.setAttribute(RequestContext.REQUESTED_URI, url); Map<String, Object> options = helper.parseKickstartUrl(url); assertNotNull(options); assertNotNull(options.get("org_id")); assertNotNull(options.get("label")); assertNotNull(options.get("ksdata")); assertNotNull(options.get("host")); }
public void testIpRangeLabel() throws Exception { KickstartIpRange range = new KickstartIpRange(); range.setMaxString("127.0.0.2"); range.setMinString("127.0.0.1"); range.setKsdata(ksdata); range.setOrg(user.getOrg()); ksdata.getIps().add(range); // URL: String url = "http://rhn.redhat.com/ks/cfg/org/" + user.getOrg().getId().toString() + "/mode/ip_range"; request.setAttribute(RequestContext.REQUESTED_URI, url); helper = new KickstartHelper(request); Map<String, Object> options = helper.parseKickstartUrl(url); assertEquals(ksdata, options.get("ksdata")); }
public void testKsSessionPathparse() throws Exception { user.addPermanentRole(RoleFactory.ORG_ADMIN); KickstartSession session = KickstartSessionTest.createKickstartSession(ksdata, user); KickstartFactory.saveKickstartSession(session); session = (KickstartSession) reload(session); assertNotSame(session.getState(), KickstartFactory.SESSION_STATE_CONFIG_ACCESSED); String encodedSession = SessionSwap.encodeData(session.getId().toString()); // URL: /kickstart/ks/session/2xb7d56e8958b0425e762cc74e8705d8e7 String url = "http://rhn.redhat.com/session/ks/session/" + encodedSession; request.setAttribute(RequestContext.REQUESTED_URI, url); Map<String, Object> options = helper.parseKickstartUrl(url); assertNotNull(options); assertNotNull(options.get("org_id")); assertNotNull(options.get("ksdata")); assertNotNull(options.get("session")); assertNotNull(options.get("host")); assertEquals(session.getState(), KickstartFactory.SESSION_STATE_CONFIG_ACCESSED); }
public void testKsNoOrg() { String url = "http://somesat.redhat.com/ks/cfg/label/" + ksdata.getLabel(); request.setAttribute(RequestContext.REQUESTED_URI, url); Map<String, Object> options = helper.parseKickstartUrl(url); assertNotNull(options); }