/** * Is it private?. * @return TRUE if it's private * @throws IOException If there is any I/O problem */ public boolean isPrivate() throws IOException { return Boolean.parseBoolean( this.json() .getOrDefault("private", JsonValue.FALSE) .toString().replace("\"", "") ); } @Override
/** * Is it prerelease. * @return Returns true if it's prerelease * @throws IOException If there is any I/O problem */ public boolean prerelease() throws IOException { return Boolean.parseBoolean( this.json() .getOrDefault("prerelease", JsonValue.FALSE) .toString().replace("\"", "") ); }
/** * Constructs a new TestConf with the given callback url and JsonObject. * * @param callbackURL a string representation of callback url. * @param jsonObject JsonObject */ public Test(String callbackURL, JsonObject jsonObject) { this.name = jsonObject.getString("name"); this.testImpl = jsonObject.getString("testImpl"); this.description = jsonObject.getString("description", "No description was provided fot this test."); this.payload = jsonObject.getOrDefault("payload", null); // Override the global value with the local value this.callbackURL = jsonObject.getString("callback", null); if (this.callbackURL == null) this.callbackURL = callbackURL; }
@GwtIncompatible @Nullable private ChannelChange[] parseChannelChanges( @Nonnull final JsonObject object ) { if ( object.containsKey( "channel_actions" ) ) { final ArrayList<ChannelChange> changes = new ArrayList<>(); for ( final JsonValue value : object.getJsonArray( "channel_actions" ) ) { final JsonObject change = (JsonObject) value; final int cid = change.getInt( "cid" ); final Integer scid = change.containsKey( "scid" ) ? change.getInt( "scid" ) : null; final ChannelChange.Action action = ChannelChange.Action.valueOf( change.getString( "action" ).toUpperCase() ); // TODO: Filters not yet supported properly final Object filter = change.getOrDefault( "filter", null ); changes.add( null == scid ? ChannelChange.create( cid, action, filter ) : ChannelChange.create( cid, scid, action, filter ) ); } return changes.toArray( new ChannelChange[ 0 ] ); } else { return null; } }
/** * Constructs a new Browser with the given remote address and JsonObject. * * @param remoteAddress a string representation of the Selenium hub url * @param jsonObject JsonObject */ public Browser(String remoteAddress, JsonObject jsonObject) throws KiteInsufficientValueException { this.browserName = jsonObject.getString("browserName"); this.version = jsonObject.getString("version"); this.platform = jsonObject.getString("platform"); this.focus = jsonObject.getBoolean("focus", true); this.headless = jsonObject.getBoolean("headless", false); this.technologyPreview = jsonObject.getBoolean("technologyPreview", false); this.remoteAddress = jsonObject.getString("remoteAddress", remoteAddress); this.pathToBinary = jsonObject.getString("pathToBinary", ""); this.fakeMediaFile = jsonObject.getString("fakeMediaFile", null); JsonValue jsonValue = jsonObject.getOrDefault("flags", null); if (jsonValue != null) { JsonArray flagArray = (JsonArray) jsonValue; for (int i = 0; i < flagArray.size(); i++){ this.flags.add(flagArray.getString(i)); } } JsonValue mobile = jsonObject.getOrDefault("mobile", null); if (mobile != null){ this.mobile = new Mobile((JsonObject) mobile); } }