Examples of StatusType


Examples of javax.ws.rs.core.Response.StatusType

        assertFalse(new ResponseImpl(200).hasEntity());
    }
   
    @Test
    public void testStatuInfoForOKStatus() {
        StatusType si = new ResponseImpl(200, "").getStatusInfo();
        assertNotNull(si);
        assertEquals(200, si.getStatusCode());
        assertEquals(Status.Family.SUCCESSFUL, si.getFamily());
        assertEquals("OK", si.getReasonPhrase());
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.StatusType

        assertEquals("OK", si.getReasonPhrase());
    }
   
    @Test
    public void testStatuInfoForClientErrorStatus() {
        StatusType si = new ResponseImpl(400, "").getStatusInfo();
        assertNotNull(si);
        assertEquals(400, si.getStatusCode());
        assertEquals(Status.Family.CLIENT_ERROR, si.getFamily());
        assertEquals("Bad Request", si.getReasonPhrase());
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.StatusType

        assertEquals("Bad Request", si.getReasonPhrase());
    }
   
    @Test
    public void testStatuInfoForClientErrorStatus2() {
        StatusType si = new ResponseImpl(499, "").getStatusInfo();
        assertNotNull(si);
        assertEquals(499, si.getStatusCode());
        assertEquals(Status.Family.CLIENT_ERROR, si.getFamily());
        assertEquals("", si.getReasonPhrase());
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.StatusType

*/
public class ResponseImplTest extends TestCase {

    public void testDeclaredStatusCodes() {
        for (Status s : Status.values()) {
            StatusType _s = ResponseImpl.toStatusType(s.getStatusCode());
            assertSame(s, _s);
        }
    }
View Full Code Here

Examples of javax.ws.rs.core.Response.StatusType

            assertSame(s, _s);
        }
    }

    public void testUndeclaredStatusCodes() {
        StatusType st = ResponseImpl.toStatusType(199);
        assertNotNull(st);
        assertEquals(199, st.getStatusCode());
        assertEquals("", st.getReasonPhrase());
        assertEquals(Family.INFORMATIONAL, st.getFamily());

        st = ResponseImpl.toStatusType(299);
        assertNotNull(st);
        assertEquals(299, st.getStatusCode());
        assertEquals("", st.getReasonPhrase());
        assertEquals(Family.SUCCESSFUL, st.getFamily());

        st = ResponseImpl.toStatusType(399);
        assertNotNull(st);
        assertEquals(399, st.getStatusCode());
        assertEquals("", st.getReasonPhrase());
        assertEquals(Family.REDIRECTION, st.getFamily());

        st = ResponseImpl.toStatusType(499);
        assertNotNull(st);
        assertEquals(499, st.getStatusCode());
        assertEquals("", st.getReasonPhrase());
        assertEquals(Family.CLIENT_ERROR, st.getFamily());

        st = ResponseImpl.toStatusType(599);
        assertNotNull(st);
        assertEquals(599, st.getStatusCode());
        assertEquals("", st.getReasonPhrase());
        assertEquals(Family.SERVER_ERROR, st.getFamily());
    }
View Full Code Here

Examples of net.gridshield.nexsm.common.StatusType

     */
    public Icon getIcon(ArchetypeVertex v) {
        Object state = v.getUserDatum("state");
        LayeredIcon myIcon = (LayeredIcon)iconMap.get(v);
        if (myIcon != null && myIcon.getImage() != null && state != null && state instanceof StatusType) {
            StatusType st = (StatusType)state;
            myIcon.remove(statesMap.get("up"));
            myIcon.remove(statesMap.get("down"));
            myIcon.remove(statesMap.get("down_acked"));
            myIcon.remove(statesMap.get("unreachable"));
            myIcon.remove(statesMap.get("up_servicesdown"));
View Full Code Here

Examples of net.gridshield.nexsm.common.StatusType

        vs = new VertexStringer() {
            public String getLabel(ArchetypeVertex v) {
                Object state = v.getUserDatum("state");
                String val = "";
                if (state != null && state instanceof StatusType) {
                    StatusType st = (StatusType)state;
                    switch (st) {
                        case Host_Up:
                            val = "UP ";
                            break;
                        case Host_Down:
View Full Code Here

Examples of net.gridshield.nexsm.common.StatusType

       
        public Paint getFillPaint( Vertex v ) {
            Color outColor = Color.LIGHT_GRAY;
            Object state = v.getUserDatum("state");
            if (state != null && state instanceof StatusType) {
                StatusType st = (StatusType)state;
                switch (st) {
                    case Host_Up:
                        outColor =  Color.GREEN;
                        break;
                    case Host_Down:
View Full Code Here

Examples of net.gridshield.nexsm.common.StatusType

           
            super.setForeground(vv.getForeground());
            Object state = vertex.getUserDatum("state");
            Color outColor = Color.LIGHT_GRAY;
            if (state != null && state instanceof StatusType) {
                StatusType st = (StatusType)state;
                switch (st) {
                    case Host_Up:
                        outColor =  new Color(27, 118, 20);
                        break;
                    case Host_Down:
View Full Code Here

Examples of net.gridshield.nexsm.common.StatusType

            if (current_state) {
                int val = 0;
                try {
                   val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                StatusType st = StatusType.STATUS_UNKNOWN; ;
                switch (val) {
                    case 0:
                        st = StatusType.Host_Up;
                    break;
                    case 1:
                        st = StatusType.Host_Down;
                    break;
                    case 2:
                        st = StatusType.Host_Unreachable;
                    break;
                }
                htmp.setCurrentState(st);
            }
            if (last_hard_state){
                int val = 0;
                try {
                   val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                StatusType st = StatusType.STATUS_UNKNOWN; ;
                switch (val) {
                    case 0:
                        st = StatusType.Host_Up;
                    break;
                    case 1:
                        st = StatusType.Host_Down;
                    break;
                    case 2:
                        st = StatusType.Host_Unreachable;
                    break;
                }
                htmp.setLastHardState(st);
            }
            if (state_type) { htmp.setStateType(str); }
            if (has_been_checked) { htmp.setHasBeenChecked(Integer.parseInt(str)); }
            if (plugin_output) { htmp.setPluginOutput(str); }
            if (performance_data){ htmp.setPerformanceData(str); }
            if (last_state_change) {htmp.setLastStateChange(Long.parseLong(str)*1000); }
            if (last_hard_state_change) {htmp.setLastHardStateChange(Long.parseLong(str)*1000); }
            if (last_time_up) {htmp.setLastTimeUp(Long.parseLong(str)*1000); }
            if (last_time_down) {htmp.setLastTimeDown(Long.parseLong(str)*1000); }
            if (last_time_unreachable) {htmp.setLastTimeUnreachable(Long.parseLong(str)*1000); }         
            if (last_update) { htmp.setLastUpdate(Long.parseLong(str)*1000); }
            if (problem_has_been_acknowledged) { htmp.setProblemHasBeenAcknowledged(str.equals("1")?true:false); }
            if (scheduled_downtime_depth) { try {
                    htmp.setScheduledDowntimeDepth(Integer.parseInt(str));
                } catch (NumberFormatException nfe) { System.out.println("NumberFormatExcetion in DHStatus:scheduledowntimedepth, " + nfe.toString()); }
            }
        } else if (serviceDefinition) {
            if (host_name) { stmp = new ServiceStatus(str); }
            if (last_check) {
                try {
                    stmp.setLastCheck(Long.parseLong(str)*1000);
                }catch (NumberFormatException nfe) {}
            }
            if (current_attempt) {
                int val = 0;
                try {
                 val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                stmp.setCurrentAttempt(val);
            }
            if (max_attempts) {
                int val = 0;
                try {
                 val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                stmp.setMaxAttempts(val)
            }
            if (current_notification_number) {
                int val = 0;
                try {
                 val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                stmp.setCurrentNotificationNumber(val);
            }
            if (current_state) {
                int val = 0;
                try {
                   val = Integer.parseInt(str);
                } catch (NumberFormatException nfe) {}
                StatusType st = StatusType.STATUS_UNKNOWN; ;
                switch (val) {
                    case 0:
                        st = StatusType.Service_State_OK;
                    break;
                    case 1:
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.