Rollbacks using liquibase Api not being made - liquibase

I am trying to do a rollback using Liquibase api but for some reason the rollbacks aren't being made
try {
Properties properties = PropertiesLoaderUtils.loadAllProperties("application.properties");
String dbUrl=properties.getProperty("spring.datasource.url");
String dbUsername=properties.getProperty("spring.datasource.username");
String dbPassword=properties.getProperty("spring.datasource.password");
String changelogPath=properties.getProperty("spring.liquibase.change-log");
Connection connection = openConnection(dbUrl,dbUsername,dbPassword);
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(connection));
Liquibase liquibase = new liquibase.Liquibase(changelogPath, new ClassLoaderResourceAccessor(), database);
liquibase.rollback(1,"");
} catch (SQLException | IOException | LiquibaseException e) {
logger.error(e.getMessage());
}
This is the message I am getting in the command line
INFO: Reading from `saft-demo-dump`.DATABASECHANGELOG
jun. 16, 2021 4:21:10 DA TARDE liquibase.lockservice
INFO: Successfully released change log lock
Do you want to see this operation's report in Liquibase Hub, which improves team collaboration?
If so, enter your email. If not, enter [N] to no longer be prompted, or [S] to skip for now, but ask again next time (default "S"):
jun. 16, 2021 4:21:51 DA TARDE liquibase.lockservice
INFO: Successfully acquired change log lock
Skipping auto-registration
jun. 16, 2021 4:21:51 DA TARDE liquibase.hub
WARNING: Skipping auto-registration
jun. 16, 2021 4:21:52 DA TARDE liquibase.lockservice
INFO: Successfully released change log lock
Am i doing something wrong?

Related

Changed predis to phpredis: Getting segmentation fault

(Code is locally tested on a mac)
I've created a simple test for Redis, but it, unfortunately, fails with [1] 27996 segmentation fault:
// Config in App.php
// Had to rename Redis, because of the use of phpredis!
'RedisManager' => Illuminate\Support\Facades\Redis::class,
//Test unit
use Illuminate\Support\Facades\Redis;
/** #test */
public function it_can_set_a_dummy_value_in_redis()
{
$value = 'Hello';
Redis::set($this->cacheKey, $value, 'EX', 60);
$this->assertEquals($value, Redis::get($this->cacheKey));
}
It fails when the command set is fired.
I went through the code up to the point: Illuminate\Redis\Connections\PhpRedisConnection.php#command
I checked what the object-value of $this->client is:
Redis {#2278
isConnected: true
host: "127.0.0.1"
port: 6379
auth: null
mode: ATOMIC
dbNum: 0
timeout: 0.0
lastError: null
persistentId: null
options: {
TCP_KEEPALIVE: 0
READ_TIMEOUT: 0.0
COMPRESSION: NONE
SERIALIZER: NONE
PREFIX: "local_database_"
SCAN: NORETRY
}
}
I check the connection with:
dd($this->client->ping()); // it's true
However, it fails at the point:
return parent::command($method, $parameters); //set is called
Even though it is in a try-catch-block, it won't be shown there...
The logs show nothing:
nginx: 0 errors
php-fpm: 0 errors
redis:
2867:M 29 Aug 2020 22:46:03.142 * Background saving started by pid 27498
27498:C 29 Aug 2020 22:46:03.145 * DB saved on disk
2867:M 29 Aug 2020 22:46:03.306 * Background saving terminated with success
So even Redis is working correctly.
I don't know what is going on. When I change to predis, everything works fine!
The only hint I have got is this thread. But since my ping() is ponged, it should work?
Any ideas how I can fix my problem?

How to get authenticated to Redis Cloud Memcached using Spymemcached?

I am trying to connect to Redis Cloud Memcached but get an error (below). I have checked that the username, password, host, and port are correct in the apps.redislabs.com interface. I able to connect if I disable SASL and connect unauthenticated.
How can I diagnose this?
(Using spymemcached 2.11.6.)
import net.spy.memcached.auth.*;
import net.spy.memcached.*;
...
List<InetSocketAddress> addresses = Collections.singletonList(addr);
AuthDescriptor ad = new AuthDescriptor(new String[] { "CRAM-MD5", "PLAIN" },
new PlainCallbackHandler(user, password));
MemcachedClient mc = new MemcachedClient(new ConnectionFactoryBuilder()
.setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
.setAuthDescriptor(ad).build(),
AddrUtil.getAddresses(host + ":" + port));
The stacktrace:
net.spy.memcached.MemcachedConnection: Added {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=0} to connect queue
net.spy.memcached.protocol.binary.BinaryMemcachedNodeImpl: Discarding partially completed op: SASL auth operation
net.spy.memcached.MemcachedConnection: Reconnecting due to exception on {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1}
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at net.spy.memcached.MemcachedConnection.handleReads(MemcachedConnection.java:820)
at net.spy.memcached.MemcachedConnection.handleReadsAndWrites(MemcachedConnection.java:720)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:683)
at net.spy.memcached.MemcachedConnection.handleIO(MemcachedConnection.java:436)
at net.spy.memcached.MemcachedConnection.run(MemcachedConnection.java:1446)
net.spy.memcached.MemcachedConnection: Closing, and reopening {QA sa=pub-memcache-14154.us-central1-1-1.gce.garantiadata.com/104.197.191.74:14514, #Rops=0, #Wops=0, #iq=0, topRop=null, topWop=null, toWrite=0, interested=1}, attempt 0.
net.spy.memcached.MemcachedConnection: Could not redistribute to another node, retrying primary node for foo.
Lose the "CRAM-MD5" in your AuthDescriptior declaration.
The following works in my tests: (user, pass, and url removed)
AuthDescriptor ad = new AuthDescriptor(new String[] {"PLAIN"}, new PlainCallbackHandler(user, pass));
MemcachedClient mc = null;
try {
mc = new MemcachedClient(
new ConnectionFactoryBuilder()
.setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
.setAuthDescriptor(ad).build(),
AddrUtil.getAddresses(host + ":" + port ));
} catch (IOException e) {
// handle exception
}
mc.set("foo", 0, "bar");
String value = (String) mc.get("foo");
System.out.println(value);

HTMLunit browser automation causes SSL error

I am writing a simple piece of Java code, to check my external IP and update my DNS entries if it has changed.
I use NetBeans and HTMLunit. The first part of the code works OK.
My code gets the proper External IP address from WhatIsMyIp.com
The second part, which involves logging into my DNS provider webpage (fastname.no) is attached below.
>
> public void LoginToDNS(HtmlPage LogInPage) throws Exception {
> try (final WebClient webClient = new WebClient()) {
>
> //get the webpage data we're looking for
> // also get the buttons and textfields
> final List<?> forms = LogInPage.getForms();
> final HtmlForm form = LogInPage.getFormByName("form1");
> final HtmlTextInput UsernameField = form.getInputByName("username");
> final HtmlPasswordInput PasswordField = form.getInputByName("password");
> final HtmlButton submit_button = form.getButtonByName("submit");
>
> // Set the Username and pasword
> UsernameField.setValueAttribute("myusername");
> PasswordField.setValueAttribute("mypassword");
>
> // submit the form by clicking the button and get back the control panel page
> final HtmlPage DNSPage = submit_button.click();
> CheckDNSEntries(DNSPage);
>
> }
> }
Although I can see that I have logged in properly (I know, because the page title changes to the correct one), I see an SSL error and the resulting webpage is not what I want.
java.util.concurrent.ExecutionException: java.io.IOException: Cannot init SSL
....
Caused by: java.io.IOException: Cannot init SSL
......
at org.eclipse.jetty.websocket.client.io.WebSocketClientSelectorManager.newConnection(WebSocketClientSelectorManager.java:96)
... 3 more
Right when I press the Submit_button, I see a hell of a lot of errors on the debugger coming from htmlunit. (see below)
Apr 12, 2016 10:36:49 AM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[https://www.fastname.no/panel/js/custom/bootstrap.js?bust=?v20160408110428] line=[66] lineSource=[null] lineOffset=[0]
Apr 12, 2016 10:36:49 AM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
SEVERE: runtimeError: message=[An invalid or illegal selector was specified (selector: '*,:x' error: Invalid selector: :x).] sourceName=[https://www.fastname.no/panel/js/custom/bootstrap.js?bust=?v20160408110428] line=[66] lineSource=[null] lineOffset=[0]
Apr 12, 2016 10:36:51 AM com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: [object Object] (https://www.googletagmanager.com/gtm.js?id=GTM-TWH4RS&bust=?v20160408110428#65)
======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException: [object Object] (https://www.googletagmanager.com/gtm.js?id=GTM-TWH4RS&bust=?v20160408110428#65)
Apr 12, 2016 10:36:52 AM com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl runSingleJob
SEVERE: Job run failed with unexpected RuntimeException: [object Object] (https://www.googletagmanager.com/gtm.js?id=GTM-TWH4RS&bust=?v20160408110428#65)
======= EXCEPTION START ========
Exception class=[net.sourceforge.htmlunit.corejs.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException: [object Object] (https://www.googletagmanager.com/gtm.js?id=GTM-TWH4RS&bust=?v20160408110428#65)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.handleJavaScriptException(JavaScriptEngine.java:982)
at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:894)
2016-04-12 10:36:55.106:INFO::JS executor for com.gargoylesoftware.htmlunit.WebClient#d1a10ac: Logging initialized #10613ms
Apr 12, 2016 10:36:55 AM com.gargoylesoftware.htmlunit.javascript.host.WebSocket run
SEVERE: WS connect error
java.util.concurrent.ExecutionException: java.io.IOException: Cannot init SSL
at org.eclipse.jetty.util.FuturePromise.get(FuturePromise.java:123)
at com.gargoylesoftware.htmlunit.javascript.host.WebSocket$1.run(WebSocket.java:130)
I am not quite sure whether this is a HTMLunit problem handling JavaScript or it's just my code. Is there a better solution that I can use instead of HTMLunit that will get me where I want to go faster? After all I think the task I want to accomplish is relatively simple.
Try to enable SSL by adding:
webClient.getOptions().setUseInsecureSSL(true);
You can find more documentation here.
EDIT:
In order to hide the HtmlUnit logs, you have to add this:
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
java.util.logging.Logger.getLogger("org.apache.commons.httpclient").setLevel(Level.OFF);

Remote response when pushing with LibGit2Sharp

In LibGit2Sharp is there anyway to get the remote response when doing a Push?
When using something like the git bash command line you get the following output in the console:
remote: Updating branch 'master'.
remote: Updating submodules.
remote: Preparing deployment for commit id '3fe0a458ac'.
remote: Generating deployment script.
remote: Running deployment command...
remote: Handling Basic Web Site deployment.
The PushOptions provides pack building, transfer and error status during a Push operation, but ideally I'd like to catch the remote response (as listed above) and feed that back to the client. Any way to do this with libgit2 / LibGit2Sharp ?
Here is a snippet of my Push action using LibGit2Sharp version 0.16.0.0
using (var repository = new Repository(sourceRepositoryPath))
{
var pushOptions = new PushOptions
{
Credentials = new Credentials { Username = remoteUser, Password = remotePassword },
OnPackBuilderProgress = (stage, current, total) =>
{
Trace.WriteLine(string.Format("Pack Building Progress {0} out of {1}, Stage {2}",
current, total, stage));
return true;
},
OnPushStatusError = errors =>
{
Trace.WriteLine(errors);
},
OnPushTransferProgress = (current, total, bytes) =>
{
Trace.WriteLine(string.Format("Transfer Progress {0} out of {1}, Bytes {2}", current, total, bytes));
return true;
}
};
string pushRefSpec = string.Format("+{0}:{0}", "refs/heads/master");
var remote = repository.Network.Remotes["origin"];
repository.Network.Push(remote, pushRefSpec, pushOptions);
}
That information is being sent by the server process in a particular channel called 'progress', which requires an agreement between both parties that they support this extension. libgit2 itself has learnt how to do this, but libgit2sharp hasn't been updated yet to support this extra channel.
Once it does, it would look like Fetch's OnProgress.

Request Time Out Error while uploading to Amazon S3 with InputStream

I am trying to upload a file on AMazon S3 using InputStream, My code is as follows and I am getting Request Time out Error, The size of file is very small around 1 MB.
ObjectMetadata metadata = new ObjectMetadata();
Long contentLength = Long.valueOf(IOUtils.toByteArray(fis).length);
metadata.setContentLength(contentLength);
try {
s3Handler.putObject(new PutObjectRequest(bucketName, s3key, fis,metadata));
} catch (AmazonServiceException ase) {
s3ExceptionHandler.processAmazonServiceException(ase);
} catch (AmazonClientException ace) {
s3ExceptionHandler.processAmazonClientException(ace);
}
Request Time Out:--
Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
Jan 30, 2013 10:15:42 AM javacode.S3ExceptionHandler processAmazonServiceException
SEVERE: HTTP Status Code: 400
Jan 30, 2013 10:15:42 AM javacode.S3ExceptionHandler processAmazonServiceException
SEVERE: AWS Error Code: RequestTimeout
It was working fine when I was using file instead of inputstream but the problem is I have only inputStream object available.
Please help.
Look this : amazon s3 upload file time out
Reset your connection after :
Long contentLength = Long.valueOf(IOUtils.toByteArray(fis).length);
fis.reset();
s3Handler.putObject(new PutObjectRequest(bucketName, s3key, fis,metadata));
It works for me