Fix wordpress connection test
This commit is contained in:
parent
705620d0a2
commit
89181c0fa9
@ -499,12 +499,25 @@ public class StationSettingsController {
|
||||
logger.log(Level.SEVERE, "SFTP connection failed", e);
|
||||
}
|
||||
} else if (messageMethod.get() == StationSettings.MessageMethod.WORDPRESS) {
|
||||
connectionTestDescription.set("Testing connection");
|
||||
connectionTestStatus.set(ConnectionStatus.NEUTRAL);
|
||||
|
||||
System.setProperty("wordpress.username", username.get());
|
||||
System.setProperty("wordpress.password", password.get());
|
||||
System.setProperty("wordpress.url", stationAddress.get());
|
||||
Post post = new Post("Title of post", "content to post");
|
||||
WordpressClient client = new WordpressClient();
|
||||
String newPostId = client.newPost(post);
|
||||
try {
|
||||
WordpressClient client = new WordpressClient();
|
||||
var postTypes = client.getPostTypes();
|
||||
|
||||
logger.log(Level.INFO, "Wordpress connection successful");
|
||||
connectionTestDescription.set("Connection succeeded");
|
||||
connectionTestStatus.set(ConnectionStatus.SUCCESS);
|
||||
} catch (Exception e) {
|
||||
connectionTestDescription.set("Worpress connection failed");
|
||||
connectionTestStatus.set(ConnectionStatus.FAILURE);
|
||||
logger.log(Level.SEVERE, "Wordpress connection failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
<PasswordField fx:id="passwordField" layoutX="444.0" layoutY="95.0" prefHeight="25.0" prefWidth="135.0" AnchorPane.rightAnchor="0.0" />
|
||||
<TextField fx:id="externalProgramCommandField" layoutX="-2.0" layoutY="131.0" prefHeight="25.0" prefWidth="580.0" AnchorPane.leftAnchor="-2.0" AnchorPane.rightAnchor="0.0" />
|
||||
<Button fx:id="testConnectionButton" layoutX="464.0" layoutY="7.0" mnemonicParsing="false" onAction="#handleTestConnectionButtonPress" text="Test connection" />
|
||||
<Label fx:id="connectionTestStatusLabel" layoutX="257.0" layoutY="11.0" prefHeight="17.0" prefWidth="196.0" AnchorPane.leftAnchor="257.0" AnchorPane.rightAnchor="125.0" />
|
||||
<Label fx:id="connectionTestStatusLabel" alignment="CENTER_RIGHT" layoutX="136.0" layoutY="11.0" prefHeight="17.0" prefWidth="317.0" textAlignment="RIGHT" AnchorPane.leftAnchor="136.0" AnchorPane.rightAnchor="125.0" />
|
||||
|
||||
</children>
|
||||
<VBox.margin>
|
||||
|
Loading…
x
Reference in New Issue
Block a user